Class NumberUtil
- java.lang.Object
-
- org.pentaho.reporting.libraries.formula.util.NumberUtil
-
public class NumberUtil extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.math.BigDecimalDELTAstatic java.math.BigDecimalINT_TEST_DELTA
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.math.BigDecimaldivide(java.math.BigDecimal bd1, java.math.BigDecimal bd2)static java.math.BigDecimalgetAsBigDecimal(java.lang.Number number)static java.math.BigDecimalperformIntRounding(java.math.BigDecimal n)Performs a rounding to get a more reliable (int) cast.static java.math.BigDecimalperformTuneRounding(java.math.BigDecimal n)static java.math.BigDecimalremoveTrailingZeros(java.math.BigDecimal bd)
-
-
-
Method Detail
-
getAsBigDecimal
public static java.math.BigDecimal getAsBigDecimal(java.lang.Number number)
-
performIntRounding
public static java.math.BigDecimal performIntRounding(java.math.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 java.math.BigDecimal performTuneRounding(java.math.BigDecimal n)
-
removeTrailingZeros
public static java.math.BigDecimal removeTrailingZeros(java.math.BigDecimal bd)
-
divide
public static java.math.BigDecimal divide(java.math.BigDecimal bd1, java.math.BigDecimal bd2) throws EvaluationException- Throws:
EvaluationException
-
-