round(n, mode)
Instance Public methods
Round to the nearest 1 (by default), returning the result as a BigDecimal.
1 2 | BigDecimal( '3.14159' ).round #=> 3 BigDecimal( '8.7' ).round #=> 9 |
If n is specified and positive, the fractional part of the result has no more than that many digits.
If n is specified and negative, at least that many digits to the left of the decimal point will be 0 in the result.
1 2 | BigDecimal( '3.14159' ).round( 3 ) #=> 3.142 BigDecimal( '13345.234' ).round(- 2 ) #=> 13300.0 |
The value of the optional mode argument can be used to determine how rounding is performed; see ::mode.
Please login to continue.