round($number)
round($number, $digits)
Rounds the floating point number number to the given number of digits.
| Name | Type | Description | Mandatory | Default |
|---|---|---|---|---|
| number | Number | A floating point number for rounding. | yes | |
| digits | Number | Specifies the number of digits after the decimal point. | no | 0 (no decimal places) |
Type: Number
The rounded number with digits decimal places. An integer if digits = 0.
round(3.141)
Output: 3
round(8.5)
Output: 9
round(4.1234, 2)
Output: 4.12
round(4.12, 5)
Output: 4.12