Package com.singularsys.jep.bigdecimal.functions

# Class BigDecRoundSigFig

java.lang.Object
com.singularsys.jep.functions.PostfixMathCommand
com.singularsys.jep.functions.BinaryFunction
com.singularsys.jep.bigdecimal.functions.BigDecRoundSigFig

All Implemented Interfaces:
  `FixedPrecisionFunctionI`, `PostfixMathCommandI`, `Serializable`

public class BigDecRoundSigFig extends BinaryFunction implements FixedPrecisionFunctionI
Rounding functions to round to a specific number of significant figures. Support all the modes in `RoundingMode`. roundSF(x,k) rounds to k significant figures. Uses the `BigDecimal.round(MathContext)` method.

Since:
  Jep 3.5
Author:
  Richard Morris
See Also:
  - Serialized Form

- ## Nested Class Summary

  ## 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
  `BigDecRoundSigFig(RoundingMode mode)`
  Constructor with a specified rounding mode.
  `BigDecRoundSigFig(RoundingMode mode, int scale)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `eval(Object l, Object r)`
  Evaluate the function
  `int`
  `getDecimalPlaces()`
  Gets the number of decimal places used.
  `void`
  `setDecimalPlaces(int scale)`
  Sets the number of decimal places to use.

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

  - ### BigDecRoundSigFig

    public BigDecRoundSigFig(RoundingMode mode)
    Constructor with a specified rounding mode.
    Parameters:
      `mode` -

  - ### BigDecRoundSigFig

    public BigDecRoundSigFig(RoundingMode mode, int scale)

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

  - ### getDecimalPlaces

    public int getDecimalPlaces()
    Description copied from interface: `FixedPrecisionFunctionI`
    Gets the number of decimal places used.
    Specified by:
      `getDecimalPlaces` in interface `FixedPrecisionFunctionI`
    Returns:
      either zero, a positive number or -1 for floating-point formats

  - ### setDecimalPlaces

    public void setDecimalPlaces(int scale)
    Description copied from interface: `FixedPrecisionFunctionI`
    Sets the number of decimal places to use.
    Specified by:
      `setDecimalPlaces` in interface `FixedPrecisionFunctionI`
    Parameters:
      `scale` - either zero, a positive number or -1 for floating-point formats