public class Decimal64 extends Number implements FieldElement<Decimal64>, Comparable<Decimal64>
double
value in an object. It is similar to the
standard class Double
, while also implementing the FieldElement
interface.Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
Decimal64(double x)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
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()) |
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
.public Decimal64(double x)
x
- the primitive double
value of the object to be createdpublic 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 addpublic Decimal64 subtract(Decimal64 a)
this.subtract(a).equals(new Decimal64(this.doubleValue()
- a.doubleValue()))
.subtract
in interface FieldElement<Decimal64>
a
- element to subtractpublic 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 multiplypublic 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 addpublic 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
.public short shortValue()
short
.shortValue
in class Number
public int intValue()
int
.public long longValue()
long
.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 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
Copyright © 2018 CNES. All Rights Reserved.