Class RInt

All Implemented Interfaces:
PostfixMathCommandI, Serializable

public class RInt extends Round
A PostfixMathCommandI which rounds a number to the closest integer.
rint(2.4) finds the closest integer to the argument (2).
rint(2.1234, 3) rounds the argument to 3 decimal places (2.123).

RInt differs from the Round class in that it uses the Math.rint() method rather than Math.round(). Unlike Math.round(), in the case of a tie (e.g 1.5) Math.rint() prefers the nearest even integer (so rint(1.5) = 2). This has better statistical properties. For the two argument version you can consider it as a rounding method with a mode of round-half-even.

In Jep 4.2 fixes a bug with round(100000,-5) -> 99999.99999999999.

Since:
3.4
Author:
Nathan Funk
See Also: