Go Back To Code List
[Math]
Current Code Entry
Go Back To Code List
[Math]
Round to the nearest whole number
Article Entry Date: April 27,2022 @ 11:17:47 / Last Updated On: April 27,2022 @ 11:17:47
We learned how to ROUND numbers in Math during school. In Classic ASP, we do the same thing, but in code instead of on paper. When we had a value less than .5, say, .4, the value left would stay the same. If it was .5 and over, the value would go up a number.


In the below code sample, the value of 125325.8 will be Rounded to 125326


If we changed the value right of the decimal to a value lower than 5, the value to the left would remain the same.
Start = "125325.4" = 125325


We can also get the value from an input field.

Then we run that value through the following code to get it whole number value.

The output will be 125326