public class Decimal64 extends Number implements RealFieldElement<Decimal64>, Comparable<Decimal64>
double
value in an object. It is similar to the
standard class Double
, while also implementing the
RealFieldElement
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 . |
DEG_TO_RAD, RAD_TO_DEG
Constructor and Description |
---|
Decimal64(double x)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
Decimal64 |
abs()
absolute value.
|
Decimal64 |
acos()
Arc cosine operation.
|
Decimal64 |
acosh()
Inverse hyperbolic cosine operation.
|
Decimal64 |
add(Decimal64 a)
Compute this + a.
|
Decimal64 |
add(double a)
'+' operator.
|
Decimal64 |
asin()
Arc sine operation.
|
Decimal64 |
asinh()
Inverse hyperbolic sine operation.
|
Decimal64 |
atan()
Arc tangent operation.
|
Decimal64 |
atan2(Decimal64 x)
Two arguments arc tangent operation.
|
Decimal64 |
atanh()
Inverse hyperbolic tangent operation.
|
byte |
byteValue()
The current implementation performs casting to a
byte . |
Decimal64 |
cbrt()
Cubic root.
|
Decimal64 |
ceil()
Get the smallest whole number larger than instance.
|
int |
compareTo(Decimal64 o)
The current implementation returns the same value as
new Double(this.doubleValue()).compareTo(new
Double(o.doubleValue())) |
Decimal64 |
copySign(Decimal64 sign)
Returns the instance with the sign of the argument.
|
Decimal64 |
copySign(double sign)
Returns the instance with the sign of the argument.
|
Decimal64 |
cos()
Cosine operation.
|
Decimal64 |
cosh()
Hyperbolic cosine operation.
|
Decimal64 |
divide(Decimal64 a)
Compute this ÷ a.
|
Decimal64 |
divide(double a)
'÷' operator.
|
double |
doubleValue() |
boolean |
equals(Object obj) |
Decimal64 |
exp()
Exponential.
|
Decimal64 |
expm1()
Exponential minus 1.
|
float |
floatValue()
The current implementation performs casting to a
float . |
Decimal64 |
floor()
Get the largest whole number smaller than instance.
|
Field<Decimal64> |
getField()
Get the
Field to which the instance belongs. |
double |
getReal()
Get the real value of the number.
|
int |
hashCode()
The current implementation returns the same value as
new Double(this.doubleValue()).hashCode() |
Decimal64 |
hypot(Decimal64 y)
Returns the hypotenuse of a triangle with sides
this and y
- sqrt(this2 +y2)
avoiding intermediate overflow or underflow. |
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. |
boolean |
isZero()
Check if an element is semantically equal to zero.
|
Decimal64 |
linearCombination(Decimal64[] a,
Decimal64[] b)
Compute a linear combination.
|
Decimal64 |
linearCombination(Decimal64 a1,
Decimal64 b1,
Decimal64 a2,
Decimal64 b2)
Compute a linear combination.
|
Decimal64 |
linearCombination(Decimal64 a1,
Decimal64 b1,
Decimal64 a2,
Decimal64 b2,
Decimal64 a3,
Decimal64 b3)
Compute a linear combination.
|
Decimal64 |
linearCombination(Decimal64 a1,
Decimal64 b1,
Decimal64 a2,
Decimal64 b2,
Decimal64 a3,
Decimal64 b3,
Decimal64 a4,
Decimal64 b4)
Compute a linear combination.
|
Decimal64 |
linearCombination(double[] a,
Decimal64[] b)
Compute a linear combination.
|
Decimal64 |
linearCombination(double a1,
Decimal64 b1,
double a2,
Decimal64 b2)
Compute a linear combination.
|
Decimal64 |
linearCombination(double a1,
Decimal64 b1,
double a2,
Decimal64 b2,
double a3,
Decimal64 b3)
Compute a linear combination.
|
Decimal64 |
linearCombination(double a1,
Decimal64 b1,
double a2,
Decimal64 b2,
double a3,
Decimal64 b3,
double a4,
Decimal64 b4)
Compute a linear combination.
|
Decimal64 |
log()
Natural logarithm.
|
Decimal64 |
log10()
Base 10 logarithm.
|
Decimal64 |
log1p()
Shifted natural logarithm.
|
long |
longValue()
The current implementation performs casting to a
long . |
Decimal64 |
multiply(Decimal64 a)
Compute this × a.
|
Decimal64 |
multiply(double a)
'×' operator.
|
Decimal64 |
multiply(int n)
Compute n × this.
|
Decimal64 |
negate()
Returns the additive inverse of
this element. |
Decimal64 |
newInstance(double v)
Create an instance corresponding to a constant real value.
|
Decimal64 |
pow(Decimal64 e)
Power operation.
|
Decimal64 |
pow(double p)
Power operation.
|
Decimal64 |
pow(int n)
Integer power operation.
|
Decimal64 |
reciprocal()
Returns the multiplicative inverse of
this element. |
Decimal64 |
remainder(Decimal64 a)
IEEE remainder operator.
|
Decimal64 |
remainder(double a)
IEEE remainder operator.
|
Decimal64 |
rint()
Get the whole number that is the nearest to the instance, or the even one if x is exactly half way between two integers.
|
Decimal64 |
rootN(int n)
Nth root.
|
Decimal64 |
scalb(int n)
Multiply the instance by a power of 2.
|
short |
shortValue()
The current implementation performs casting to a
short . |
Decimal64 |
signum()
Compute the signum of the instance.
|
Decimal64 |
sin()
Sine operation.
|
Decimal64 |
sinh()
Hyperbolic sine operation.
|
Decimal64 |
sqrt()
Square root.
|
Decimal64 |
subtract(Decimal64 a)
Compute this - a.
|
Decimal64 |
subtract(double a)
'-' operator.
|
Decimal64 |
tan()
Tangent operation.
|
Decimal64 |
tanh()
Hyperbolic tangent operation.
|
Decimal64 |
toDegrees()
Convert radians to degrees, with error of less than 0.5 ULP
|
Decimal64 |
toRadians()
Convert degrees to radians, with error of less than 0.5 ULP
|
String |
toString()
The returned
String is equal to
Double.toString(this.doubleValue()) |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
round
getExponent, sinCos
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 Decimal64 newInstance(double v)
The default implementation creates the instance by adding
the value to getField().getZero()
. This is not optimal
and does not work when called with a negative zero as the
sign of zero is lost with the addition. The default implementation
should therefore be overridden in concrete classes. The default
implementation will be removed at the next major version.
newInstance
in interface CalculusFieldElement<Decimal64>
v
- constant real valuepublic 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 divide bypublic Decimal64 reciprocal()
this
element.
The current implementation strictly enforces
this.reciprocal().equals(new Decimal64(1.0
/ this.doubleValue()))
.reciprocal
in interface CalculusFieldElement<Decimal64>
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 boolean isZero()
The default implementation simply calls equals(getField().getZero())
.
However, this may need to be overridden in some cases as due to
compatibility with hashCode()
some classes implements
equals(Object)
in such a way that -0.0 and +0.0 are different,
which may be a problem. It prevents for example identifying a diagonal
element is zero and should be avoided when doing partial pivoting in
LU decomposition.
This implementation considers +0.0 and -0.0 to be equal.
isZero
in interface FieldElement<Decimal64>
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
).isInfinite
in interface CalculusFieldElement<Decimal64>
true
if this
number is infinitepublic boolean isNaN()
true
if this
double precision number is
Not-a-Number (NaN
), false otherwise.isNaN
in interface CalculusFieldElement<Decimal64>
true
if this
is NaN
public double getReal()
getReal
in interface CalculusFieldElement<Decimal64>
public Decimal64 add(double a)
add
in interface CalculusFieldElement<Decimal64>
a
- right hand side parameter of the operatorpublic Decimal64 subtract(double a)
subtract
in interface CalculusFieldElement<Decimal64>
a
- right hand side parameter of the operatorpublic Decimal64 multiply(double a)
multiply
in interface CalculusFieldElement<Decimal64>
a
- right hand side parameter of the operatorpublic Decimal64 divide(double a)
divide
in interface CalculusFieldElement<Decimal64>
a
- right hand side parameter of the operatorpublic Decimal64 remainder(double a)
remainder
in interface CalculusFieldElement<Decimal64>
a
- right hand side parameter of the operatorpublic Decimal64 remainder(Decimal64 a)
remainder
in interface CalculusFieldElement<Decimal64>
a
- right hand side parameter of the operatorpublic Decimal64 abs()
abs
in interface RealFieldElement<Decimal64>
public Decimal64 ceil()
ceil
in interface CalculusFieldElement<Decimal64>
public Decimal64 floor()
floor
in interface CalculusFieldElement<Decimal64>
public Decimal64 rint()
rint
in interface CalculusFieldElement<Decimal64>
public Decimal64 signum()
signum
in interface CalculusFieldElement<Decimal64>
public Decimal64 copySign(Decimal64 sign)
sign
argument is treated as positive.copySign
in interface CalculusFieldElement<Decimal64>
sign
- the sign for the returned valuesign
argumentpublic Decimal64 copySign(double sign)
sign
argument is treated as positive.copySign
in interface CalculusFieldElement<Decimal64>
sign
- the sign for the returned valuesign
argumentpublic Decimal64 scalb(int n)
scalb
in interface CalculusFieldElement<Decimal64>
n
- power of 2public Decimal64 hypot(Decimal64 y)
this
and y
- sqrt(this2 +y2)
avoiding intermediate overflow or underflow.
hypot
in interface CalculusFieldElement<Decimal64>
y
- a valuepublic Decimal64 sqrt()
sqrt
in interface CalculusFieldElement<Decimal64>
public Decimal64 cbrt()
cbrt
in interface CalculusFieldElement<Decimal64>
public Decimal64 rootN(int n)
rootN
in interface CalculusFieldElement<Decimal64>
n
- order of the rootpublic Decimal64 pow(double p)
pow
in interface CalculusFieldElement<Decimal64>
p
- power to applypublic Decimal64 pow(int n)
pow
in interface CalculusFieldElement<Decimal64>
n
- power to applypublic Decimal64 pow(Decimal64 e)
pow
in interface CalculusFieldElement<Decimal64>
e
- exponentpublic Decimal64 exp()
exp
in interface CalculusFieldElement<Decimal64>
public Decimal64 expm1()
expm1
in interface CalculusFieldElement<Decimal64>
public Decimal64 log()
log
in interface CalculusFieldElement<Decimal64>
public Decimal64 log1p()
log1p
in interface CalculusFieldElement<Decimal64>
public Decimal64 log10()
log10
in interface CalculusFieldElement<Decimal64>
public Decimal64 cos()
cos
in interface CalculusFieldElement<Decimal64>
public Decimal64 sin()
sin
in interface CalculusFieldElement<Decimal64>
public Decimal64 tan()
tan
in interface CalculusFieldElement<Decimal64>
public Decimal64 acos()
acos
in interface CalculusFieldElement<Decimal64>
public Decimal64 asin()
asin
in interface CalculusFieldElement<Decimal64>
public Decimal64 atan()
atan
in interface CalculusFieldElement<Decimal64>
public Decimal64 atan2(Decimal64 x)
atan2
in interface CalculusFieldElement<Decimal64>
x
- second argument of the arc tangentpublic Decimal64 cosh()
cosh
in interface CalculusFieldElement<Decimal64>
public Decimal64 sinh()
sinh
in interface CalculusFieldElement<Decimal64>
public Decimal64 tanh()
tanh
in interface CalculusFieldElement<Decimal64>
public Decimal64 acosh()
acosh
in interface CalculusFieldElement<Decimal64>
public Decimal64 asinh()
asinh
in interface CalculusFieldElement<Decimal64>
public Decimal64 atanh()
atanh
in interface CalculusFieldElement<Decimal64>
public Decimal64 toDegrees()
toDegrees
in interface CalculusFieldElement<Decimal64>
public Decimal64 toRadians()
toRadians
in interface CalculusFieldElement<Decimal64>
public Decimal64 linearCombination(Decimal64[] a, Decimal64[] b) throws MathIllegalArgumentException
linearCombination
in interface CalculusFieldElement<Decimal64>
a
- Factors.b
- Factors.Σi ai bi
.MathIllegalArgumentException
- if arrays dimensions don't matchpublic Decimal64 linearCombination(double[] a, Decimal64[] b) throws MathIllegalArgumentException
linearCombination
in interface CalculusFieldElement<Decimal64>
a
- Factors.b
- Factors.Σi ai bi
.MathIllegalArgumentException
- if arrays dimensions don't matchpublic Decimal64 linearCombination(Decimal64 a1, Decimal64 b1, Decimal64 a2, Decimal64 b2)
linearCombination
in interface CalculusFieldElement<Decimal64>
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second termCalculusFieldElement.linearCombination(Object, Object, Object, Object, Object, Object)
,
CalculusFieldElement.linearCombination(Object, Object, Object, Object, Object, Object, Object, Object)
public Decimal64 linearCombination(double a1, Decimal64 b1, double a2, Decimal64 b2)
linearCombination
in interface CalculusFieldElement<Decimal64>
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second termCalculusFieldElement.linearCombination(double, Object, double, Object, double, Object)
,
CalculusFieldElement.linearCombination(double, Object, double, Object, double, Object, double, Object)
public Decimal64 linearCombination(Decimal64 a1, Decimal64 b1, Decimal64 a2, Decimal64 b2, Decimal64 a3, Decimal64 b3)
linearCombination
in interface CalculusFieldElement<Decimal64>
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second terma3
- first factor of the third termb3
- second factor of the third termCalculusFieldElement.linearCombination(Object, Object, Object, Object)
,
CalculusFieldElement.linearCombination(Object, Object, Object, Object, Object, Object, Object, Object)
public Decimal64 linearCombination(double a1, Decimal64 b1, double a2, Decimal64 b2, double a3, Decimal64 b3)
linearCombination
in interface CalculusFieldElement<Decimal64>
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second terma3
- first factor of the third termb3
- second factor of the third termCalculusFieldElement.linearCombination(double, Object, double, Object)
,
CalculusFieldElement.linearCombination(double, Object, double, Object, double, Object, double, Object)
public Decimal64 linearCombination(Decimal64 a1, Decimal64 b1, Decimal64 a2, Decimal64 b2, Decimal64 a3, Decimal64 b3, Decimal64 a4, Decimal64 b4)
linearCombination
in interface CalculusFieldElement<Decimal64>
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second terma3
- first factor of the third termb3
- second factor of the third terma4
- first factor of the fourth termb4
- second factor of the fourth termCalculusFieldElement.linearCombination(Object, Object, Object, Object)
,
CalculusFieldElement.linearCombination(Object, Object, Object, Object, Object, Object)
public Decimal64 linearCombination(double a1, Decimal64 b1, double a2, Decimal64 b2, double a3, Decimal64 b3, double a4, Decimal64 b4)
linearCombination
in interface CalculusFieldElement<Decimal64>
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second terma3
- first factor of the third termb3
- second factor of the third terma4
- first factor of the fourth termb4
- second factor of the fourth termCalculusFieldElement.linearCombination(double, Object, double, Object)
,
CalculusFieldElement.linearCombination(double, Object, double, Object, double, Object)
Copyright © 2016–2020 Hipparchus.org. All rights reserved.