Class Java15BigDecimalHandler

    • Field Detail

      • PROPERTY_MINIMUM_PRECISION

        public static final String PROPERTY_MINIMUM_PRECISION
        An integer property that provides the minimum precision to be used for division operations.

        The property can only be set globally. The default value is 16.

        See Also:
        Constant Field Values
    • Constructor Detail

      • Java15BigDecimalHandler

        public Java15BigDecimalHandler()
      • Java15BigDecimalHandler

        public Java15BigDecimalHandler​(int minPrecision)
    • Method Detail

      • divide

        public BigDecimal divide​(BigDecimal dividend,
                                 BigDecimal divisor)
        Divides the values using the biggest of the dividend precision, the divisor precision and the configured minimum precision as result precision, and RoundingMode.HALF_UP as rounding mode.
        Specified by:
        divide in interface BigDecimalHandler
        Parameters:
        dividend - the dividend
        divisor - the divisor
        Returns:
        the division result, rounded according to the rules of the specific implementation
        See Also:
        PROPERTY_MINIMUM_PRECISION
      • getDivisionPrecision

        protected int getDivisionPrecision​(BigDecimal dividend,
                                           BigDecimal divisor)
      • getMathContext

        protected MathContext getMathContext​(int precision)