|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.math.util.BigReal
public class BigReal
Arbitrary precision decimal number.
This class is a simple wrapper around the standard BigDecimal
in order to implement the FieldElement interface.
| Field Summary | |
|---|---|
static BigReal |
ONE
A big real representing 1. |
static BigReal |
ZERO
A big real representing 0. |
| Constructor Summary | |
|---|---|
BigReal(BigDecimal val)
Build an instance from a BigDecimal. |
|
BigReal(BigInteger val)
Build an instance from a BigInteger. |
|
BigReal(BigInteger unscaledVal,
int scale)
Build an instance from an unscaled BigInteger. |
|
BigReal(BigInteger unscaledVal,
int scale,
MathContext mc)
Build an instance from an unscaled BigInteger. |
|
BigReal(BigInteger val,
MathContext mc)
Build an instance from a BigInteger. |
|
BigReal(char[] in)
Build an instance from a characters representation. |
|
BigReal(char[] in,
int offset,
int len)
Build an instance from a characters representation. |
|
BigReal(char[] in,
int offset,
int len,
MathContext mc)
Build an instance from a characters representation. |
|
BigReal(char[] in,
MathContext mc)
Build an instance from a characters representation. |
|
BigReal(double val)
Build an instance from a double. |
|
BigReal(double val,
MathContext mc)
Build an instance from a double. |
|
BigReal(int val)
Build an instance from an int. |
|
BigReal(int val,
MathContext mc)
Build an instance from an int. |
|
BigReal(long val)
Build an instance from a long. |
|
BigReal(long val,
MathContext mc)
Build an instance from a long. |
|
BigReal(String val)
Build an instance from a String representation. |
|
BigReal(String val,
MathContext mc)
Build an instance from a String representation. |
|
| Method Summary | |
|---|---|
BigReal |
add(BigReal a)
Compute this + a. |
BigDecimal |
bigDecimalValue()
Get the BigDecimal value corresponding to the instance. |
int |
compareTo(BigReal a)
|
BigReal |
divide(BigReal a)
Compute this ÷ a. |
double |
doubleValue()
Get the double value corresponding to the instance. |
boolean |
equals(Object other)
|
Field<BigReal> |
getField()
Get the Field to which the instance belongs. |
RoundingMode |
getRoundingMode()
Gets the rounding mode for division operations The default is RoundingMode.HALF_UP |
int |
getScale()
Sets the scale for division operations. |
int |
hashCode()
|
BigReal |
multiply(BigReal a)
Compute this × a. |
void |
setRoundingMode(RoundingMode roundingMode)
Sets the rounding mode for decimal divisions. |
void |
setScale(int scale)
Sets the scale for division operations. |
BigReal |
subtract(BigReal a)
Compute this - a. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final BigReal ZERO
public static final BigReal ONE
| Constructor Detail |
|---|
public BigReal(BigDecimal val)
val - value of the instancepublic BigReal(BigInteger val)
val - value of the instance
public BigReal(BigInteger unscaledVal,
int scale)
unscaledVal - unscaled valuescale - scale to use
public BigReal(BigInteger unscaledVal,
int scale,
MathContext mc)
unscaledVal - unscaled valuescale - scale to usemc - to used
public BigReal(BigInteger val,
MathContext mc)
val - value of the instancemc - context to usepublic BigReal(char[] in)
in - character representation of the value
public BigReal(char[] in,
int offset,
int len)
in - character representation of the valueoffset - offset of the first character to analyzelen - length of the array slice to analyze
public BigReal(char[] in,
int offset,
int len,
MathContext mc)
in - character representation of the valueoffset - offset of the first character to analyzelen - length of the array slice to analyzemc - context to use
public BigReal(char[] in,
MathContext mc)
in - character representation of the valuemc - context to usepublic BigReal(double val)
val - value of the instance
public BigReal(double val,
MathContext mc)
val - value of the instancemc - context to usepublic BigReal(int val)
val - value of the instance
public BigReal(int val,
MathContext mc)
val - value of the instancemc - context to usepublic BigReal(long val)
val - value of the instance
public BigReal(long val,
MathContext mc)
val - value of the instancemc - context to usepublic BigReal(String val)
val - character representation of the value
public BigReal(String val,
MathContext mc)
val - character representation of the valuemc - context to use| Method Detail |
|---|
public RoundingMode getRoundingMode()
RoundingMode.HALF_UP
public void setRoundingMode(RoundingMode roundingMode)
roundingMode - rounding mode for decimal divisionspublic int getScale()
public void setScale(int scale)
scale - scale for division operationspublic BigReal add(BigReal a)
add in interface FieldElement<BigReal>a - element to add
public BigReal subtract(BigReal a)
subtract in interface FieldElement<BigReal>a - element to subtract
public BigReal divide(BigReal a)
throws ArithmeticException
divide in interface FieldElement<BigReal>a - element to add
ArithmeticException - if a is the zero of the
additive operation (i.e. additive identity)public BigReal multiply(BigReal a)
multiply in interface FieldElement<BigReal>a - element to multiply
public int compareTo(BigReal a)
compareTo in interface Comparable<BigReal>public double doubleValue()
public BigDecimal bigDecimalValue()
public boolean equals(Object other)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic Field<BigReal> getField()
Field to which the instance belongs.
getField in interface FieldElement<BigReal>Field to which the instance belongs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||