Class BigDecRound
java.lang.Object
com.singularsys.jep.functions.PostfixMathCommand
com.singularsys.jep.functions.NaryFunction
com.singularsys.jep.functions.Round
com.singularsys.jep.bigdecimal.functions.BigDecRound
- All Implemented Interfaces:
PostfixMathCommandI,Serializable
Rounding functions for BigDecimals. Support all the modes in
RoundingMode
as well as a mode compatible with Math.round(double).
Two types of function are supported round(x) rounds to 0 decimal places
and round(x,k) rounds to k decimal places. This can be used to implement
floor() and ceil() functions.
Uses the BigDecimal.setScale(int,RoundingMode) method.- Since:
- Jep 3.5
- Author:
- Richard Morris
- See Also:
-
Field Summary
Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, name, NaN, numberOfParameters -
Constructor Summary
ConstructorsConstructorDescriptionConstructor with a rounding mode matching the behavior or Math.round, that is it equivalent to Math.floor(a + 0.5d).BigDecRound(RoundingMode mode) Constructor with a specified rounding mode. -
Method Summary
Methods inherited from class com.singularsys.jep.functions.Round
checkNumberOfParameters, eval, round, runMethods inherited from class com.singularsys.jep.functions.PostfixMathCommand
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString, toString
-
Constructor Details
-
BigDecRound
public BigDecRound()Constructor with a rounding mode matching the behavior or Math.round, that is it equivalent to Math.floor(a + 0.5d). This does not match any of the modes inRoundingMode. -
BigDecRound
Constructor with a specified rounding mode.- Parameters:
mode-
-
-
Method Details
-
round
- Overrides:
roundin classRound- Throws:
EvaluationException
-
round
- Overrides:
roundin classRound- Throws:
EvaluationException
-