public class Decimal64 extends Number implements CalculusFieldElement<Decimal64>, Comparable<Decimal64>
double
value in an object. It is similar to the
standard class Double
, while also implementing the
CalculusFieldElement
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 |
PI
The constant value of π 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 |
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. |
Decimal64 |
getPi()
Get the Archimedes constant π.
|
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 |
sign()
Compute the sign of the instance.
|
Decimal64 |
sin()
Sine operation.
|
FieldSinCos<Decimal64> |
sinCos()
Combined Sine and Cosine operation.
|
Decimal64 |
sinh()
Hyperbolic sine operation.
|
FieldSinhCosh<Decimal64> |
sinhCosh()
Combined hyperbolic sine and sosine 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()) |
Decimal64 |
ulp()
Compute least significant bit (Unit in Last Position) for a number.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getExponent, isFinite, norm, round
public static final Decimal64 ZERO
0d
as a Decimal64
.public static final Decimal64 ONE
1d
as a Decimal64
.public static final Decimal64 PI
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)
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 FieldElement<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()
Just another name for CalculusFieldElement.norm()
abs
in interface CalculusFieldElement<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 sign()
sign
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 ulp()
ulp
in interface CalculusFieldElement<Decimal64>
public 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 FieldSinCos<Decimal64> sinCos()
sinCos
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)
Beware of the order or arguments! As this is based on a
two-arguments functions, in order to be consistent with
arguments order, the instance is the first argument
and the single provided argument is the second argument.
In order to be consistent with programming languages atan2
,
this method computes atan2(this, x)
, i.e. the instance
represents the y
argument and the x
argument is
the one passed as a single argument. This may seem confusing especially
for users of Wolfram alpha, as this site is not consistent
with programming languages atan2
two-arguments arc tangent
and puts x
as its first argument.
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 FieldSinhCosh<Decimal64> sinhCosh()
sinhCosh
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(FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement)
,
CalculusFieldElement.linearCombination(FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement)
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, FieldElement, double, FieldElement, double, FieldElement)
,
CalculusFieldElement.linearCombination(double, FieldElement, double, FieldElement, double, FieldElement, double, FieldElement)
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(FieldElement, FieldElement, FieldElement, FieldElement)
,
CalculusFieldElement.linearCombination(FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement)
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, FieldElement, double, FieldElement)
,
CalculusFieldElement.linearCombination(double, FieldElement, double, FieldElement, double, FieldElement, double, FieldElement)
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(FieldElement, FieldElement, FieldElement, FieldElement)
,
CalculusFieldElement.linearCombination(FieldElement, FieldElement, FieldElement, FieldElement, FieldElement, FieldElement)
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, FieldElement, double, FieldElement)
,
CalculusFieldElement.linearCombination(double, FieldElement, double, FieldElement, double, FieldElement)
public Decimal64 getPi()
Archimedes constant is the ratio of a circle's circumference to its diameter.
getPi
in interface CalculusFieldElement<Decimal64>
Copyright © 2016-2021 CS GROUP. All rights reserved.