Class Factorial
- java.lang.Object
-
- com.singularsys.jep.functions.PostfixMathCommand
-
- com.singularsys.jep.functions.UnaryFunction
-
- com.singularsys.jep.misc.functions.Factorial
-
- All Implemented Interfaces:
PostfixMathCommandI
,java.io.Serializable
public class Factorial extends UnaryFunction
Simple implementation of factorial, good up to 20!- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, name, NaN, numberOfParameters
-
-
Constructor Summary
Constructors Constructor Description Factorial()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
eval(java.lang.Object arg)
Evaluates the factorial function-
Methods inherited from class com.singularsys.jep.functions.UnaryFunction
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
-
-
-
-
Method Detail
-
eval
public java.lang.Object eval(java.lang.Object arg) throws EvaluationException
Evaluates the factorial function- Specified by:
eval
in classUnaryFunction
- Parameters:
arg
- number to find factorial of- Returns:
- the factorial as a Long integer
- Throws:
EvaluationException
- if argument is greater than 20 causing overflow in result
-
-