org.eigenbase.util14
Class NumberUtil
java.lang.Object
org.eigenbase.util14.NumberUtil
public class NumberUtil
- extends Object
Utility functions for working with numbers This class is JDK 1.4 compatible.
- Since:
- Jan 9, 2006
- Version:
- $Id: //open/dev/farrago/src/org/eigenbase/util14/NumberUtil.java#12 $
- Author:
- angel
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
floatFormatter
private static final DecimalFormat floatFormatter
doubleFormatter
private static final DecimalFormat doubleFormatter
bigIntTenPow
private static final BigInteger[] bigIntTenPow
bigIntMinUnscaled
private static final BigInteger[] bigIntMinUnscaled
bigIntMaxUnscaled
private static final BigInteger[] bigIntMaxUnscaled
bigIntTen
private static final BigInteger bigIntTen
MIN_BYTE
public static final Byte MIN_BYTE
MAX_BYTE
public static final Byte MAX_BYTE
MIN_INTEGER
public static final Integer MIN_INTEGER
MAX_INTEGER
public static final Integer MAX_INTEGER
MIN_SHORT
public static final Short MIN_SHORT
MAX_SHORT
public static final Short MAX_SHORT
MIN_LONG
public static final Long MIN_LONG
MAX_LONG
public static final Long MAX_LONG
MIN_FLOAT
public static final Float MIN_FLOAT
MAX_FLOAT
public static final Float MAX_FLOAT
MIN_DOUBLE
public static final Double MIN_DOUBLE
MAX_DOUBLE
public static final Double MAX_DOUBLE
INTEGER_ZERO
public static final Integer INTEGER_ZERO
INTEGER_ONE
public static final Integer INTEGER_ONE
NumberUtil
public NumberUtil()
powTen
public static final BigInteger powTen(int exponent)
getMaxUnscaled
public static final BigInteger getMaxUnscaled(int precision)
getMinUnscaled
public static final BigInteger getMinUnscaled(int precision)
rescaleBigDecimal
public static final BigDecimal rescaleBigDecimal(BigDecimal bd,
int scale)
toBigDecimal
public static final BigDecimal toBigDecimal(Number number,
int scale)
toBigDecimal
public static final BigDecimal toBigDecimal(Number number)
isValidDecimal
public static boolean isValidDecimal(BigDecimal bd)
- Returns:
- whether a BigDecimal is a valid Farrago decimal. If a
BigDecimal's unscaled value overflows a long, then it is not a valid
Farrago decimal.
getApproxFormatter
public static NumberFormat getApproxFormatter(boolean isFloat)
round
public static long round(double d)
add
public static Double add(Double a,
Double b)
divide
public static Double divide(Double a,
Double b)
multiply
public static Double multiply(Double a,
Double b)