Class NumberUtil


  • public class NumberUtil
    extends Object
    • Field Detail

      • MINUTE_ROUNDING_DELTA

        public static final BigDecimal MINUTE_ROUNDING_DELTA
      • INT_TEST_DELTA

        public static final BigDecimal INT_TEST_DELTA
    • Method Detail

      • performIntRounding

        public static BigDecimal performIntRounding​(BigDecimal n)
        Performs a rounding to get a more reliable (int) cast. This makes sure that nearly exact values like 0.9999999..9999 are correctly interpreted as 1 while exact values like 0.99 are interpreted as 0.
        Parameters:
        n -
        Returns:
      • performMinuteRounding

        public static BigDecimal performMinuteRounding​(BigDecimal n)
        Performs a rounding to get a more reliable (int) cast for minute function MinuteFunction. See org.pentaho.reporting.libraries.formula.util.NumberUtilTest#testPerformMinuteRounding() for more information.
        Parameters:
        n - value of the BigDecimal to be rounded
        Returns:
        a BigDecimal rounded value
        See Also:
        org.pentaho.reporting.libraries.formula.function.datetime.MinuteFunctionTest.java