Class BigDecRound

  • All Implemented Interfaces:
    PostfixMathCommandI, java.io.Serializable

    public class BigDecRound
    extends Round
    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:
    Serialized Form
    • Constructor Detail

      • 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 in RoundingMode.
      • BigDecRound

        public BigDecRound​(java.math.RoundingMode mode)
        Constructor with a specified rounding mode.
        Parameters:
        mode -