[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-developers] ASP always round up
- Subject: Re: [cobalt-developers] ASP always round up
- From: "Ian Gibbons" <cobalt-dev1@xxxxxxxxxxxxx>
- Date: Thu Sep 4 01:48:01 2003
- Organization: Fish.Net Ltd
- List-id: Discussion Forum for developers on Sun Cobalt Networks products <cobalt-developers.list.cobalt.com>
On 4 Sep 2003 at 15:22, Todd Kirk wrote:
> Hi All,
>
> Have a need to always round up returned number values. Any ideas on how to
> achieve this with ASP on a RAQ4R?
>
> I have looked at Round(var) but see no way to always round up to the nearest
> whole number.
>
> .net has a function called 'ceiling' which performs what I want...anything
> like that in ASP I'm not aware of?
>
>
> kind regards,
>
> Todd Kirk
Hi Todd,
This should do it:
<%
Randomize
for x=1 to 20
' generate some random numbers between 1-100 for testing
r = (100 * Rnd) + 1
Response.write r & ", " & RoundUp(r) & "<BR>"
next
function RoundUp( num )
If IsNumeric(num) then
if fix(num) <> num then
RoundUp = fix(num)+1
else
RoundUp = num
end if
end if
end function
%>
Regards
Ian
--