View Full Version : Converting Floating point #'s to Integers in ASP
Gerbill
04-06-2004, 05:52 AM
I have a problem with floating poinst. For some reason in my ASP page it is doing floating point math instead of integer math even when I cast all the variables involved to integers.
i.e. CInt(variable) and it still comes out as a floating point number.
Does anyone know how to set it to integers??
Thanks,
Gerbill
See what I mean, hear what I say, listen for my words~
Gerbill
04-06-2004, 06:11 AM
Ok sorry for taking up forum room here... I fixed my problem.
If anyone else needs the answer you have to do this. This is my example... actual code that I am using.
<%
If (intNbrItems > (intNbrItemsPerPage * (Fix (intNbrItems / intNbrItemsPerPage))))Then
intNbrPages = (intNbrItems / intNbrItemsPerPage) + 1
ElseIf ((intNbrItems / intNbrItemsPerPage) < 1) Then
intNbrPages = 1
Else
intNbrPages = (intNbrItems / intNbrItemsPerPage)
End If
%>
You have to do a "Fix(variable or math equation) and it will round it down to the next lowest #.
I you have exp with this and find that this is not ALWAYS the case then please tell me!
Thanks,
Gerbill
See what I mean, hear what I say, listen for my words~
vBulletin® ©Jelsoft Enterprises Ltd.