com.singularsys.jep.functions

## Class RInt

- java.lang.Object
- - com.singularsys.jep.functions.PostfixMathCommand
  - - com.singularsys.jep.functions.NaryFunction
    - - com.singularsys.jep.functions.Round
      - - com.singularsys.jep.functions.RInt

- All Implemented Interfaces:
    PostfixMathCommandI, java.io.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.

  Since:
    3.4
  Author:
    Nathan Funk
  See Also:
    `Round`, Serialized Form

- - ### Field Summary

    - ### Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand

      `curNumberOfParameters, name, NaN, numberOfParameters`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RInt()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected double` | `rint(double param)`
    `java.lang.Object` | `round(java.lang.Object arg)`
    `java.lang.Object` | `round(java.lang.Object l, java.lang.Object r)`

    - ### Methods inherited from class com.singularsys.jep.functions.Round

      `checkNumberOfParameters, eval, round, run`

    - ### Methods inherited from class com.singularsys.jep.functions.PostfixMathCommand

      `asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### RInt

          public RInt()

  - ### Method Detail

    - #### rint

          protected double rint(double param)

    - #### round

          public java.lang.Object round(java.lang.Object arg)
                                 throws EvaluationException

      Overrides:
        `round` in class `Round`
      Throws:
        `EvaluationException`

    - #### round

          public java.lang.Object round(java.lang.Object l,
                                        java.lang.Object r)
                                 throws EvaluationException

      Overrides:
        `round` in class `Round`
      Throws:
        `EvaluationException`

Copyright © 2018 Singular Systems http://www.singularsys.com/jep