round() function
The round() function rounds floating-point numbers.
grammar:
1 |
|
parameter:
number: required. Specifies the value to be rounded.
precision: optional. Specifies the mantissa after the decimal point. The default is 0, and can also be negative.
mode: optional. Specifies a constant representing the rounding mode.
round() example
Example 1, round numbers to two decimal places, set negative numbers:
1 2 3 4 5 6 7 8 9 10 |
|
Example 2, using constants to round numbers:
1 2 3 4 5 6 7 8 9 10 11 |
|