Class RInt

  extended by com.singularsys.jep.functions.PostfixMathCommand
      extended by com.singularsys.jep.functions.Round
          extended by com.singularsys.jep.functions.RInt
All Implemented Interfaces:

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.

Nathan Funk
See Also:
Round, Serialized Form

Field Summary
Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, name, NaN, numberOfParameters
Constructor Summary
Method Summary
protected  double round(double param)
          The rounding method which implements the core rounding operation used in this class.
Methods inherited from class com.singularsys.jep.functions.Round
checkNumberOfParameters, round, run
Methods inherited from class com.singularsys.jep.functions.PostfixMathCommand
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, checkStack, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public RInt()
Method Detail


protected double round(double param)
Description copied from class: Round
The rounding method which implements the core rounding operation used in this class. Other subclasses (such as RInt) can override this to perform custom rounding.

round in class Round
the rounded value

Copyright © 2010 Singular Systems