Package com.singularsys.jep.misc.functions

# 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`, `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.

Both arguments are converted to double and the result is a double.

Author:
  Richard Morris
See Also:
  - `Modulus`
  - Serialized Form

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `Remainder.Type`
  The type of rounding to perform.

  ## Nested classes/interfaces inherited from class com.singularsys.jep.functions.BinaryFunction

  `BinaryFunction.BiFunctionWithException<T>`

- ## Field Summary

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

  `curNumberOfParameters, description, name, NaN, numberOfParameters`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Remainder(Remainder.Type type)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `eval(Object l, Object r)`
  Evaluate the function
  `double`
  `evaluate(double D, double d)`

  ### Methods inherited from class com.singularsys.jep.functions.BinaryFunction

  `instanceOf, instanceOf, instanceOf, instanceOf, run`

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

  `asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, asType, checkNumberOfParameters, 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

  - ### Remainder

    public Remainder(Remainder.Type type)
    Parameters:
      `type` - type of remainder operation to perform

- ## Method Details

  - ### eval

    public Object eval(Object l, Object r) throws EvaluationException
    Description copied from class: `BinaryFunction`
    Evaluate the function
    Specified by:
      `eval` in class `BinaryFunction`
    Parameters:
      `l` - lhs argument
      `r` - rhs argument
    Returns:
      the results
    Throws:
      `EvaluationException` - if the function cannot be evaluated.

  - ### evaluate

    public double evaluate(double D, double d)
    Specified by:
      `evaluate` in interface `RealBinaryFunction`