|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.nrao.sss.math.MathUtil
public class MathUtil
A utility class for mathematical concepts.
Version Info:
$Revision: 1472 $ |
$Date: 2008-08-06 09:43:05 -0600 (Wed, 06 Aug 2008) $ |
$Author: dharland $ (last person to modify) |
Field Summary | |
---|---|
static MathContext |
HALF_UP_50
Deprecated. Use MC_FINAL_CALC or MC_INTERM_CALCS
Precision of 50, rounding mode of half-up. |
static MathContext |
MC_FINAL_CALC
A math context to use when storing object properties as BigDecimals. |
static MathContext |
MC_INTERM_CALCS
A math context to use on intermediate calculations that are stepping stones to a final value. |
static BigDecimal |
NEGATIVE_INFINITY
A BigDecimal whose value is negative and whose doubleValue() is infinite according to the Double class. |
static BigDecimal |
POSITIVE_INFINITY
A BigDecimal whose value is positive and whose doubleValue() is infinite according to the Double class. |
Constructor Summary | |
---|---|
MathUtil()
|
Method Summary | |
---|---|
static boolean |
doubleValueIsInfinite(BigDecimal number)
Returns true if number.doubleValue() is determined to be infinite by the Double class. |
static BigDecimal |
getInfiniteValue(int signum)
Returns a BigDecimal whose double value is infinite, according to the Double class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@Deprecated public static final MathContext HALF_UP_50
MC_FINAL_CALC
or MC_INTERM_CALCS
Precision of 50, rounding mode of half-up.public static final MathContext MC_FINAL_CALC
MC_INTERM_CALCS
.
public static final MathContext MC_INTERM_CALCS
MC_FINAL_CALC
context, which has a slightly lower precision.
public static final BigDecimal POSITIVE_INFINITY
It is important to note that this value is not infinite in the eyes of the BigDecimal class. The BigDecimal class has no concept of infinity. It is also important to note that this value may not be the smallest positive value whose doubleValue() is infinite. This value is convenient for clients who need to approximate Double.POSITIVE_INFINITY in the form of a BigDecimal.
If you want to test a BigDecimal for infinity, do not
compare to this value. Instead, use
doubleValueIsInfinite(BigDecimal)
.
public static final BigDecimal NEGATIVE_INFINITY
It is important to note that this value is not infinite in the eyes of the BigDecimal class. The BigDecimal class has no concept of infinity. It is also important to note that this value may not be the largest negative value whose doubleValue() is infinite. This value is convenient for clients who need to approximate Double.NEGATIVE_INFINITY in the form of a BigDecimal.
If you want to test a BigDecimal for infinity, do not
compare to this value. Instead, use
doubleValueIsInfinite(BigDecimal)
.
Constructor Detail |
---|
public MathUtil()
Method Detail |
---|
public static boolean doubleValueIsInfinite(BigDecimal number)
number
- the number to be tested for infinite value.
public static BigDecimal getInfiniteValue(int signum)
signum
- a positive value will result in a positive return value, and
a negative value will result in a negative return value.
A value of zero will result in a runtime exception.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |