org.pentaho.reporting.libraries.formula.util
Class NumberUtil
java.lang.Object
org.pentaho.reporting.libraries.formula.util.NumberUtil
public class NumberUtil
- extends java.lang.Object
Method Summary |
static java.math.BigDecimal |
divide(java.math.BigDecimal bd1,
java.math.BigDecimal bd2)
|
static java.math.BigDecimal |
getAsBigDecimal(java.lang.Number number)
|
static java.math.BigDecimal |
performIntRounding(java.math.BigDecimal n)
Performs a rounding to get a more reliable (int) cast. |
static java.math.BigDecimal |
performTuneRounding(java.math.BigDecimal n)
|
static java.math.BigDecimal |
removeTrailingZeros(java.math.BigDecimal bd)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DELTA
public static final java.math.BigDecimal DELTA
INT_TEST_DELTA
public static final java.math.BigDecimal INT_TEST_DELTA
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