|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.lang.Number
com.numericalmethod.suanshu.number.ScientificNotation
public class ScientificNotation
Scientific notation expresses a number in this form
x = a * 10b
a is called significand or mantissa, and 1 ≤ |a| < 10.
b is called the exponent and is an integer.
Strictly speaking, 0 cannot be represented in this notation.
In this implementation, however, we will express it as x = 0 * 100
| Field Summary | |
|---|---|
int |
exponent
the exponent |
java.math.BigDecimal |
significand
the significand or mantissa |
| Constructor Summary | |
|---|---|
ScientificNotation(java.math.BigDecimal x)
Construct a ScientificNotation from a BigDecimal. |
|
ScientificNotation(java.math.BigDecimal significand,
int exponent)
Construct a ScientificNotation for x = a * 10b. |
|
ScientificNotation(java.math.BigInteger x)
Construct a ScientificNotation from a BigInteger. |
|
ScientificNotation(double x)
Construct a ScientificNotation from a double. |
|
ScientificNotation(double significand,
int exponent)
Construct a ScientificNotation for x = a * 10b. |
|
ScientificNotation(long x)
Construct a ScientificNotation from a long. |
|
| Method Summary | |
|---|---|
double |
doubleValue()
|
float |
floatValue()
|
int |
intValue()
|
long |
longValue()
|
java.math.BigDecimal |
value()
Get the value of the specified number as a BigDecimal. |
| Methods inherited from class java.lang.Number |
|---|
byteValue, shortValue |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final java.math.BigDecimal significand
public final int exponent
| Constructor Detail |
|---|
public ScientificNotation(double significand,
int exponent)
x = a * 10b.
significand - the significandexponent - the exponent
public ScientificNotation(java.math.BigDecimal significand,
int exponent)
x = a * 10b.
significand - the significandexponent - the exponentpublic ScientificNotation(java.math.BigDecimal x)
x - a BigDecimal numberpublic ScientificNotation(java.math.BigInteger x)
x - a BigInteger integerpublic ScientificNotation(long x)
x - a long integerpublic ScientificNotation(double x)
x - a double number| Method Detail |
|---|
public int intValue()
intValue in class java.lang.Numberpublic long longValue()
longValue in class java.lang.Numberpublic float floatValue()
floatValue in class java.lang.Numberpublic double doubleValue()
doubleValue in class java.lang.Numberpublic java.math.BigDecimal value()
BigDecimal.
There is no rounding.
BigDecimal.
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||