Re: How to round up. by Alex
Alex
Sun Dec 07 20:50:44 CST 2003
Ray,
It definitely works _exactly_ like Math.ceil. There's an easier way though.
I used the same way you showed until I ran across the fact that Math.ceil(x)
= - Math.floor(-x). Since VBScript's Int() is identical to a floor, rounding
up can be done simply with:
-Int(-x)
Slick, huh? VBScript is almost never that compact...
Ray at <%=sLocation%> wrote:
> This might work.
>
> Function RoundUp(someNum)
> If CLng(someNum) = CDbl(someNum) Then
> RoundUp = someNum
> Else
> RoundUp = Int(someNum) + 1
> End If
> End Function
>
> Ray at work
>
>
> "Don Grover" <spamfree@assoft.com.au> wrote in message
> news:Oy7OgOluDHA.1788@tk2msftngp13.phx.gbl...
>> Using vbscript How can I round up to the next int
>> Don