org.pentaho.reporting.libraries.formula.util
Class NumberUtil
java.lang.Object
org.pentaho.reporting.libraries.formula.util.NumberUtil
public class NumberUtil
- extends Object
DELTA
public static final BigDecimal DELTA
INT_TEST_DELTA
public static final BigDecimal INT_TEST_DELTA
getAsBigDecimal
public static BigDecimal getAsBigDecimal(Number number)
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:
performTuneRounding
public static BigDecimal performTuneRounding(BigDecimal n)
removeTrailingZeros
public static BigDecimal removeTrailingZeros(BigDecimal bd)
divide
public static BigDecimal divide(BigDecimal bd1,
BigDecimal bd2)
throws EvaluationException
- Throws:
EvaluationException