|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
totalcross.lang.Objecttotalcross.util.BigDecimal
public class BigDecimal
| Field Summary | |
|---|---|
static BigDecimal |
ONE
The constant one as a BigDecimal with scale zero. |
static int |
ROUND_CEILING
RoundingMode |
static int |
ROUND_DOWN
RoundingMode |
static int |
ROUND_FLOOR
RoundingMode |
static int |
ROUND_HALF_DOWN
RoundingMode |
static int |
ROUND_HALF_EVEN
RoundingMode |
static int |
ROUND_HALF_UP
RoundingMode |
static int |
ROUND_UNNECESSARY
RoundingMode |
static int |
ROUND_UP
RoundingMode |
static BigDecimal |
TEN
The constant ten as a BigDecimal with scale zero. |
static BigDecimal |
ZERO
The constant zero as a BigDecimal with scale zero. |
| Constructor Summary | |
|---|---|
BigDecimal(BigInteger num)
Constructs a BigDecimal whose unscaled value is num and whose scale is zero. |
|
BigDecimal(BigInteger num,
int scale)
Constructs a BigDecimal whose unscaled value is num and whose scale is scale. |
|
BigDecimal(double num)
|
|
BigDecimal(int val)
Constructs a new BigDecimal whose unscaled value is val and whose scale is zero. |
|
BigDecimal(long val)
Constructs a new BigDecimal whose unscaled value is val and whose scale is zero. |
|
BigDecimal(String num)
|
|
| Method Summary | |
|---|---|
BigDecimal |
abs()
|
BigDecimal |
add(BigDecimal val)
|
byte |
byteValueExact()
Converts this BigDecimal into a byte by first calling longValueExact and then checking that the long
returned from that method fits into a byte. |
int |
compareTo(BigDecimal val)
|
int |
compareTo(Object other)
Must return > 0 if this object is greater than the other one, < 0 if its smaller, and 0 if they are equal. |
BigDecimal |
divide(BigDecimal divisor)
Performs division, if the resulting quotient requires rounding (has a nonterminating decimal expansion), an ArithmeticException is thrown. |
BigDecimal |
divide(BigDecimal val,
int roundingMode)
|
BigDecimal |
divide(BigDecimal val,
int newScale,
int roundingMode)
|
BigDecimal[] |
divideAndRemainder(BigDecimal val)
Returns a BigDecimal array, the first element of which is the integer part of this / val, and the second element of which is the remainder of that quotient. |
BigDecimal |
divideToIntegralValue(BigDecimal val)
Returns a BigDecimal whose value is the integer part of the quotient this / val. |
double |
doubleValue()
|
boolean |
equals(Object o)
|
int |
hashCode()
|
int |
intValue()
|
int |
intValueExact()
Converts this BigDecimal into an int by first calling longValueExact and then checking that the long
returned from that method fits into an int. |
long |
longValue()
|
long |
longValueExact()
Converts this BigDecimal to a long value. |
BigDecimal |
max(BigDecimal val)
|
BigDecimal |
min(BigDecimal val)
|
BigDecimal |
movePointLeft(int n)
|
BigDecimal |
movePointRight(int n)
|
BigDecimal |
multiply(BigDecimal val)
|
BigDecimal |
negate()
|
BigDecimal |
plus()
Returns this BigDecimal. |
BigDecimal |
pow(int n)
Returns a BigDecimal whose value is this to the power of n. |
int |
precision()
Returns the precision of this BigDecimal (the number of digits in the unscaled value). |
BigDecimal |
remainder(BigDecimal val)
Returns a BigDecimal whose value is the remainder in the quotient this / val. |
int |
scale()
|
BigDecimal |
scaleByPowerOfTen(int n)
Returns a BigDecimal whose numerical value is the numerical value of this BigDecimal multiplied by 10 to the power of n. |
BigDecimal |
setScale(int scale)
|
BigDecimal |
setScale(int scale,
int roundingMode)
|
short |
shortValueExact()
Converts this BigDecimal into a short by first calling longValueExact and then checking that the long
returned from that method fits into a short. |
int |
signum()
|
BigDecimal |
stripTrailingZeros()
Returns a BigDecimal which is numerically equal to this BigDecimal but with no trailing zeros in the representation. |
BigDecimal |
subtract(BigDecimal val)
|
BigInteger |
toBigInteger()
Converts this BigDecimal to a BigInteger. |
BigInteger |
toBigIntegerExact()
Converts this BigDecimal into a BigInteger, throwing an ArithmeticException if the conversion is not exact. |
String |
toEngineeringString()
Returns the totalcross.lang.String representation of this BigDecimal, using engineering notation if necessary. |
String |
toPlainString()
Returns a totalcross.lang.String representation of this BigDecimal without using scientific notation. |
String |
toString()
Returns the totalcross.lang.String representation of this BigDecimal, using scientific notation if necessary. |
BigDecimal |
ulp()
Returns the size of a unit in the last place of this BigDecimal. |
BigInteger |
unscaledValue()
|
static BigDecimal |
valueOf(double val)
Returns a new BigDecimal constructed from the BigDecimal(String) constructor using the Double .toString(double) method to obtain the String. |
static BigDecimal |
valueOf(long val)
|
static BigDecimal |
valueOf(long val,
int scale)
|
| Methods inherited from class totalcross.lang.Object |
|---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final BigDecimal ZERO
public static final BigDecimal ONE
public static final BigDecimal TEN
public static final int ROUND_UP
public static final int ROUND_DOWN
public static final int ROUND_CEILING
public static final int ROUND_FLOOR
public static final int ROUND_HALF_UP
public static final int ROUND_HALF_DOWN
public static final int ROUND_HALF_EVEN
public static final int ROUND_UNNECESSARY
| Constructor Detail |
|---|
public BigDecimal(String num)
throws InvalidNumberException
InvalidNumberExceptionpublic BigDecimal(int val)
val - the value of the new BigDecimalpublic BigDecimal(long val)
val - the value of the new BigDecimalpublic BigDecimal(BigInteger num)
num - the value of the new BigDecimal
public BigDecimal(BigInteger num,
int scale)
num - scale -
public BigDecimal(double num)
throws InvalidNumberException
InvalidNumberException| Method Detail |
|---|
public static BigDecimal valueOf(long val)
throws InvalidNumberException
InvalidNumberException
public static BigDecimal valueOf(long val,
int scale)
throws InvalidNumberException
InvalidNumberExceptionpublic BigDecimal add(BigDecimal val)
public BigDecimal subtract(BigDecimal val)
public BigDecimal multiply(BigDecimal val)
public BigDecimal divide(BigDecimal val,
int roundingMode)
throws totalcross.lang.ArithmeticException,
totalcross.lang.IllegalArgumentException
totalcross.lang.ArithmeticException
totalcross.lang.IllegalArgumentException
public BigDecimal divide(BigDecimal val,
int newScale,
int roundingMode)
throws totalcross.lang.ArithmeticException,
totalcross.lang.IllegalArgumentException
totalcross.lang.ArithmeticException
totalcross.lang.IllegalArgumentException
public BigDecimal divide(BigDecimal divisor)
throws totalcross.lang.ArithmeticException,
totalcross.lang.IllegalArgumentException
totalcross.lang.ArithmeticException
totalcross.lang.IllegalArgumentException
public BigDecimal remainder(BigDecimal val)
throws totalcross.lang.ArithmeticException,
totalcross.lang.IllegalArgumentException,
InvalidNumberException
val - the divisor
InvalidNumberException
totalcross.lang.IllegalArgumentException
totalcross.lang.ArithmeticException
totalcross.lang.ArithmeticException - if val == 0
public BigDecimal[] divideAndRemainder(BigDecimal val)
throws totalcross.lang.ArithmeticException,
totalcross.lang.IllegalArgumentException,
InvalidNumberException
val - the divisor
InvalidNumberException
totalcross.lang.IllegalArgumentException
totalcross.lang.ArithmeticException
totalcross.lang.ArithmeticException - if val == 0
public BigDecimal divideToIntegralValue(BigDecimal val)
throws totalcross.lang.ArithmeticException,
totalcross.lang.IllegalArgumentException,
InvalidNumberException
val - the divisor
InvalidNumberException
totalcross.lang.IllegalArgumentException
totalcross.lang.ArithmeticException
totalcross.lang.ArithmeticException - if val == 0public int compareTo(BigDecimal val)
public boolean equals(Object o)
public int hashCode()
hashCode in class totalcross.lang.Objectpublic BigDecimal max(BigDecimal val)
public BigDecimal min(BigDecimal val)
public BigDecimal movePointLeft(int n)
public BigDecimal movePointRight(int n)
public int signum()
public int scale()
public BigInteger unscaledValue()
public BigDecimal abs()
public BigDecimal negate()
public BigDecimal plus()
public int precision()
public String toString()
scale == 0 is returned.
2. an int adjExp is created which is equal to the negation of scale plus the number of
digits in the unscaled value, minus one. 3. if scale >= 0 && adjExp >= -6 then we represent this
BigDecimal without scientific notation. A decimal is added if the scale is positive and zeros are prepended as
necessary. 4. if scale is negative or adjExp is less than -6 we use scientific notation. If the unscaled value has
more than one digit, a decimal as inserted after the first digit, the character 'E' is appended and adjExp is
appended.
public String toEngineeringString()
public String toPlainString()
public BigInteger toBigInteger()
public BigInteger toBigIntegerExact()
public int intValue()
public BigDecimal stripTrailingZeros()
throws InvalidNumberException
InvalidNumberExceptionpublic long longValue()
public double doubleValue()
throws InvalidNumberException
InvalidNumberException
public BigDecimal setScale(int scale)
throws totalcross.lang.ArithmeticException
totalcross.lang.ArithmeticException
public BigDecimal setScale(int scale,
int roundingMode)
throws totalcross.lang.ArithmeticException,
totalcross.lang.IllegalArgumentException
totalcross.lang.ArithmeticException
totalcross.lang.IllegalArgumentException
public static BigDecimal valueOf(double val)
throws InvalidNumberException
val - the double value used in Double .toString(double)
InvalidNumberException - if val is NaN or infinitepublic BigDecimal scaleByPowerOfTen(int n)
n.
n - the power of ten
public BigDecimal pow(int n)
this to the power of n.
n - the power
public BigDecimal ulp()
this.public long longValueExact()
totalcross.lang.ArithmeticException - if rounding occurs or if overflow occurspublic int intValueExact()
long
returned from that method fits into an int.
this
totalcross.lang.ArithmeticException - if this BigDecimal has a fractional part or is too large to fit into an int.public byte byteValueExact()
long
returned from that method fits into a byte.
this
totalcross.lang.ArithmeticException - if this BigDecimal has a fractional part or is too large to fit into a byte.public short shortValueExact()
long
returned from that method fits into a short.
this
totalcross.lang.ArithmeticException - if this BigDecimal has a fractional part or is too large to fit into a short.
public int compareTo(Object other)
throws totalcross.lang.ClassCastException
Comparable
compareTo in interface Comparabletotalcross.lang.ClassCastException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||