Int(), Round()
These two functions are for losing precision. INT() removes the decimal portion of a number. ROUND() lets you specify the desired precision and then it rounds more or less according to the usual rounding rules.
Usage |
nNoDecimals = INT( nNumber ) nRounded = ROUND( nNumToRound, nPlaces ) |
Parameter |
Value |
Meaning |
nNumber or nNumToRound |
Numeric, Float, Integer, Double or Currency |
Number to be processed. |
nPlaces |
0 |
Rounds to the nearest integer. |
Positive |
Rounds to the specified number of decimal places. |
|
Negative |
Rounds to the specified power of 10. For example, passing nPlaces=-2 rounds to the nearest hundred. |
Example |
? INT(37.2738) && Returns 37 ? ROUND(37.2738,0) && Returns 37 ? ROUND(37.2738,1) && Returns 37.3 ? ROUND(37.2738,2) && Returns 37.27 ? ROUND(37.2738,3) && Returns 37.274 ? ROUND(37.2738,-1) && Returns 40 ? ROUND(37.2738,-2) && Returns 0 ? ROUND(-11.92,0) && Returns -12 ? ROUND(-11.92,1) && Returns -11.9 ? ROUND(-11.92,-1) && Returns -10 |
See Also |