|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Number org.apache.commons.math3.util.Decimal64
public class Decimal64
This class wraps a double
value in an object. It is similar to the
standard class Double
, while also implementing the
FieldElement
interface.
Field Summary | |
---|---|
static Decimal64 |
NAN
The constant value of Double.NaN as a Decimal64 . |
static Decimal64 |
NEGATIVE_INFINITY
The constant value of Double.NEGATIVE_INFINITY as a
Decimal64 . |
static Decimal64 |
ONE
The constant value of 1d as a Decimal64 . |
static Decimal64 |
POSITIVE_INFINITY
The constant value of Double.POSITIVE_INFINITY as a
Decimal64 . |
static Decimal64 |
ZERO
The constant value of 0d as a Decimal64 . |
Constructor Summary | |
---|---|
Decimal64(double x)
Creates a new instance of this class. |
Method Summary | |
---|---|
Decimal64 |
add(Decimal64 a)
Compute this + a. |
byte |
byteValue()
The current implementation performs casting to a byte . |
int |
compareTo(Decimal64 o)
The current implementation returns the same value as new Double(this.doubleValue()).compareTo(new
Double(o.doubleValue())) |
Decimal64 |
divide(Decimal64 a)
Compute this ÷ a. |
double |
doubleValue()
|
boolean |
equals(Object obj)
|
float |
floatValue()
The current implementation performs casting to a float . |
Field<Decimal64> |
getField()
Get the Field to which the instance belongs. |
int |
hashCode()
The current implementation returns the same value as new Double(this.doubleValue()).hashCode() |
int |
intValue()
The current implementation performs casting to a int . |
boolean |
isInfinite()
Returns true if this double precision number is infinite
(Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY ). |
boolean |
isNaN()
Returns true if this double precision number is
Not-a-Number (NaN ), false otherwise. |
long |
longValue()
The current implementation performs casting to a long . |
Decimal64 |
multiply(Decimal64 a)
Compute this × a. |
Decimal64 |
multiply(int n)
Compute n × this. |
Decimal64 |
negate()
Returns the additive inverse of this element. |
Decimal64 |
reciprocal()
Returns the multiplicative inverse of this element. |
short |
shortValue()
The current implementation performs casting to a short . |
Decimal64 |
subtract(Decimal64 a)
Compute this - a. |
String |
toString()
The returned String is equal to
Double.toString(this.doubleValue()) |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Decimal64 ZERO
0d
as a Decimal64
.
public static final Decimal64 ONE
1d
as a Decimal64
.
public static final Decimal64 NEGATIVE_INFINITY
Double.NEGATIVE_INFINITY
as a
Decimal64
.
public static final Decimal64 POSITIVE_INFINITY
Double.POSITIVE_INFINITY
as a
Decimal64
.
public static final Decimal64 NAN
Double.NaN
as a Decimal64
.
Constructor Detail |
---|
public Decimal64(double x)
x
- the primitive double
value of the object to be createdMethod Detail |
---|
public Field<Decimal64> getField()
Field
to which the instance belongs.
getField
in interface FieldElement<Decimal64>
Field
to which the instance belongspublic Decimal64 add(Decimal64 a)
this.add(a).equals(new Decimal64(this.doubleValue()
+ a.doubleValue()))
.
add
in interface FieldElement<Decimal64>
a
- element to add
public Decimal64 subtract(Decimal64 a)
this.subtract(a).equals(new Decimal64(this.doubleValue()
- a.doubleValue()))
.
subtract
in interface FieldElement<Decimal64>
a
- element to subtract
public Decimal64 negate()
this
element.
The current implementation strictly enforces
this.negate().equals(new Decimal64(-this.doubleValue()))
.
negate
in interface FieldElement<Decimal64>
this
.public Decimal64 multiply(Decimal64 a)
this.multiply(a).equals(new Decimal64(this.doubleValue()
* a.doubleValue()))
.
multiply
in interface FieldElement<Decimal64>
a
- element to multiply
public Decimal64 multiply(int n)
this.multiply(n).equals(new Decimal64(n * this.doubleValue()))
.
multiply
in interface FieldElement<Decimal64>
n
- Number of times this
must be added to itself.
public Decimal64 divide(Decimal64 a)
this.divide(a).equals(new Decimal64(this.doubleValue()
/ a.doubleValue()))
.
divide
in interface FieldElement<Decimal64>
a
- element to add
public Decimal64 reciprocal()
this
element.
The current implementation strictly enforces
this.reciprocal().equals(new Decimal64(1.0
/ this.doubleValue()))
.
reciprocal
in interface FieldElement<Decimal64>
this
.public byte byteValue()
byte
.
byteValue
in class Number
public short shortValue()
short
.
shortValue
in class Number
public int intValue()
int
.
intValue
in class Number
public long longValue()
long
.
longValue
in class Number
public float floatValue()
float
.
floatValue
in class Number
public double doubleValue()
doubleValue
in class Number
public int compareTo(Decimal64 o)
new Double(this.doubleValue()).compareTo(new
Double(o.doubleValue()))
compareTo
in interface Comparable<Decimal64>
Double.compareTo(Double)
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
new Double(this.doubleValue()).hashCode()
hashCode
in class Object
Double.hashCode()
public String toString()
String
is equal to
Double.toString(this.doubleValue())
toString
in class Object
Double.toString(double)
public boolean isInfinite()
true
if this
double precision number is infinite
(Double.POSITIVE_INFINITY
or Double.NEGATIVE_INFINITY
).
true
if this
number is infinitepublic boolean isNaN()
true
if this
double precision number is
Not-a-Number (NaN
), false otherwise.
true
if this
is NaN
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |