Class Remainder
- java.lang.Object
-
- com.singularsys.jep.functions.PostfixMathCommand
-
- com.singularsys.jep.functions.BinaryFunction
-
- com.singularsys.jep.misc.functions.Remainder
-
- All Implemented Interfaces:
PostfixMathCommandI
,RealBinaryFunction
,java.io.Serializable
public class Remainder extends BinaryFunction implements RealBinaryFunction
Calculates the remainder and quotient the arguments. Three different algorithms can be used- TRUNCATED: q = (int) (x/y), r = x - q y . Remainder has same sign as divisor.
- FLOOR: q = floor(x/y), r = x - q y. Remainder has same sign as dividend.
- EUCLIDEAN: y>0, q = floor(x/y), y<0, ceil(x/y), r = x - q y. Remainder is non negative.
- Author:
- Richard Morris
- See Also:
Modulus
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Remainder.Type
-
Field Summary
-
Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, name, NaN, numberOfParameters
-
-
Constructor Summary
Constructors Constructor Description Remainder(Remainder.Type type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
eval(java.lang.Object l, java.lang.Object r)
double
evaluate(double D, double d)
-
Methods inherited from class com.singularsys.jep.functions.BinaryFunction
instanceOf, instanceOf, run
-
Methods inherited from class com.singularsys.jep.functions.PostfixMathCommand
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, checkNumberOfParameters, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString, toString
-
-
-
-
Constructor Detail
-
Remainder
public Remainder(Remainder.Type type)
- Parameters:
type
- type of remainer operation to perform
-
-
Method Detail
-
eval
public java.lang.Object eval(java.lang.Object l, java.lang.Object r) throws EvaluationException
- Specified by:
eval
in classBinaryFunction
- Throws:
EvaluationException
-
evaluate
public double evaluate(double D, double d)
- Specified by:
evaluate
in interfaceRealBinaryFunction
-
-