Package 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`, `Serializable`

public class RInt extends Round
A PostfixMathCommandI which rounds a number to the closest integer. Single argument version `rint(2.4)` finds the closest integer to the argument `2` and with two arguments `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(double)` method rather than `Math.round(double)`. 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.1 fixes a bug with `round(100000,-5) -> 99999.99999999999`.

Since:
  3.4
Author:
  Nathan Funk
See Also:
  - Serialized Form

- ## Field Summary

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

  `curNumberOfParameters, description, name, NaN, numberOfParameters`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RInt()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected double`
  `rint(double param)`
  `Object`
  `round(Object arg)`
  `Object`
  `round(Object l, 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, asType, getDescription, getDescription, getDescriptionWithType, getName, getNumberOfParameters, setCurNumberOfParameters, setDescription, setName, toString, toString`

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

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

- ## Constructor Details

  - ### RInt

    public RInt()

- ## Method Details

  - ### rint

    protected double rint(double param)

  - ### round

    public Object round(Object arg) throws EvaluationException
    Overrides:
      `round` in class `Round`
    Throws:
      `EvaluationException`

  - ### round

    public Object round(Object l, Object r) throws EvaluationException
    Overrides:
      `round` in class `Round`
    Throws:
      `EvaluationException`