Click to See Complete Forum and Search --> : CEIL or similar function in ASP?


deepakdatta
10-27-2003, 09:54 AM
Hi there,
I want to know if there is any way we can implement the CEIL function in ASP

Alternately, functionality I am trying to achieve is whatever result I get, it should be rounded off to the next highest integer. So if my calculation yields 3.01 as result, it should be rounded to 4. What is the best way in ASP to implement this ?

Thanks a Ton,
Deepak

rdoekes
10-27-2003, 10:29 AM
Can't say I ever worked with ceilings....:

Function Ceiling(intNumber)
Dim dblNumber
dblNumber = CDbl(intNumber)

If Int(dblNumber * 10) MOD 10 > 0 Then
Ceiling = Int(dblNumber) + 1
Else
Ceiling = Int(dblNumber)
End If
End Function
hope this is what you are looking for.

-Rogier Doekes

deepakdatta
10-27-2003, 11:34 AM
Thanks Rogier, it worked great!

jagmohan.tyagi@
02-13-2008, 06:06 AM
function cieling(num1)
num2=cDBL(num1/2)
num3=cint(num1/2)
if num2 > cDbl(num3) then
num3=num3+1
end if
cieling=num3
end function