roundToNearest
Returns the multiple of step closest to this value.
Ties round away from zero, so 1.25.roundToNearest(0.5) is 1.5 and (-1.25).roundToNearest(0.5) is -1.5. Results that round to zero return positive zero. NaN and infinities are returned unchanged. Throws IllegalArgumentException when step is not a finite positive number.
Returns the multiple of step closest to this value.
Ties round away from zero, so 25.roundToNearest(10) is 30 and (-25).roundToNearest(10) is -30. The computation runs in Long, and ArithmeticException is thrown when the rounded result does not fit in Int. Throws IllegalArgumentException when step is not positive.