com.singularsys.jep.bigdecimal.functions

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

- - ### Field Summary

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

      `curNumberOfParameters, name, NaN, numberOfParameters`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BigDecRound()` Constructor with a rounding mode matching the behavior or Math.round, that is it equivalent to Math.floor(a + 0.5d).
    `BigDecRound(java.math.RoundingMode mode)` Constructor with a specified rounding mode.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `round(java.lang.Object l)`
    `java.lang.Object` | `round(java.lang.Object l, java.lang.Object r)`

    - ### Methods inherited from class com.singularsys.jep.functions.Round

      `checkNumberOfParameters, eval, round, run`

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

      `asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

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

  - ### Method Detail

    - #### round

          public java.lang.Object round(java.lang.Object l)
                                 throws EvaluationException

      Overrides:
        `round` in class `Round`
      Throws:
        `EvaluationException`

    - #### round

          public java.lang.Object round(java.lang.Object l,
                                        java.lang.Object r)
                                 throws EvaluationException

      Overrides:
        `round` in class `Round`
      Throws:
        `EvaluationException`

Copyright © 2018 Singular Systems http://www.singularsys.com/jep