public class ScientificNotation extends Number
x = a * 10ba is called the 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. This implementation, however, expresses it as 0 = 0 * 100.
Constructor and Description |
---|
ScientificNotation(BigDecimal x)
Construct the scientific notation of a number.
|
ScientificNotation(BigDecimal significand,
int exponent)
Construct the scientific notation of a number in this form: x = a * 10b.
|
ScientificNotation(BigInteger x)
Construct the scientific notation of an integer.
|
ScientificNotation(double x)
Construct the scientific notation of a
double . |
ScientificNotation(double significand,
int exponent)
Construct the scientific notation of a number in this form: x = a * 10b.
|
ScientificNotation(long x)
Construct the scientific notation of a
long . |
Modifier and Type | Method and Description |
---|---|
BigDecimal |
bigDecimalValue()
Convert the number to
BigDecimal . |
double |
doubleValue() |
int |
exponent()
Get the exponent.
|
float |
floatValue() |
int |
intValue() |
long |
longValue() |
BigDecimal |
significand()
Get the significand.
|
byteValue, shortValue
public ScientificNotation(double significand, int exponent)
significand
- the significandexponent
- the exponentpublic ScientificNotation(BigDecimal significand, int exponent)
significand
- the significandexponent
- the exponentpublic ScientificNotation(BigDecimal x)
x
- a numberpublic ScientificNotation(BigInteger x)
x
- an integerpublic ScientificNotation(long x)
long
.x
- a long
integerpublic ScientificNotation(double x)
double
.x
- a double
numberpublic BigDecimal significand()
public int exponent()
public BigDecimal bigDecimalValue()
BigDecimal
.
There is no rounding.BigDecimal
representation of the numberpublic float floatValue()
floatValue
in class Number
public double doubleValue()
doubleValue
in class Number
Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.