B
Brent Bortnick
Is there a way to make your numbers always round up. Ex:
if the number is 0.0341 it will round to 0.035
Brent
if the number is 0.0341 it will round to 0.035
Brent
Brent Bortnick said:Is there a way to make your numbers always round up. Ex:
if the number is 0.0341 it will round to 0.035
If you always want it at the thousandths, you could say:
<%
function roundUp(n)
if clng(n*10000) = 10 * clng(n*1000) then
n = formatnumber(n, 3)
else
n = formatnumber(n + 0.0005, 3)
end if
roundup = n
end function
response.write "<br>" & roundUp(0.0341)
response.write "<br>" & roundUp(0.03409)
response.write "<br>" & roundUp(0.0340)
response.write "<br>" & roundUp(0.0359)
%>
Aaron Bertrand - MVP said:if clng(n*10000) = 10 * clng(n*1000) then
n = formatnumber(n, 3)
else
n = formatnumber(n + 0.0005, 3)
end if
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.