public final class Real extends Object implements FieldElement<Real>
| Modifier and Type | Class and Description |
|---|---|
static class |
Real.Interval
An interval on the real line.
|
| Modifier and Type | Method and Description |
|---|---|
double |
abs()
Compute and return the absolute value of this element.
|
Real |
additiveInverse()
Take the additive inverse, or negative, of this real number and return the result.
|
double |
asDouble() |
int |
compareTo(Real other) |
Complex |
complexSqrt() |
Real |
conjugate()
Compute and return the conjugate of this element.
|
Real |
cubed()
Cube this real number and return the result.
|
Real |
dividedBy(Real other)
Divide this real number by the given real number and return the result.
|
static Real |
from(double value)
Create a new real number using the given double.
|
Complex |
minus(Complex complex) |
Real |
minus(Real other)
Subtract the given real number from this real number and return the result.
|
Complex |
plus(Complex complex) |
Real |
plus(Real other)
Add this real number to the given real number and return the result.
|
Real |
sqrt()
Computes and returns the square root of this number if the number is non-negative, and throws
an IllegalStateException otherwise.
|
Real |
squared()
Square this real number and return the result.
|
Real |
times(double other) |
Real |
times(Real other)
Multiply this real number by the given real number and return the result.
|
String |
toString() |
static Real |
zero() |
public static Real from(double value)
value - the primitive double approximating the real number.public static Real zero()
public Real plus(Real other)
plus in interface FieldElement<Real>other - the real number to add to this one.public Real minus(Real other)
minus in interface FieldElement<Real>other - the real number to subtract from this one.public Real times(Real other)
times in interface FieldElement<Real>other - the real number to multiply this one by.public Real sqrt()
complexSqrt() should be used instead.sqrt in interface FieldElement<Real>IllegalStateException - if this real number is less than zero.public Complex complexSqrt()
public Real conjugate()
FieldElementconjugate in interface FieldElement<Real>public Real times(double other)
public Real squared()
public Real cubed()
public Real dividedBy(Real other)
dividedBy in interface FieldElement<Real>other - the real number to divide this one by.public Real additiveInverse()
additiveInverse in interface FieldElement<Real>public double abs()
FieldElementabs in interface FieldElement<Real>public double asDouble()
public int compareTo(@NonNull
Real other)
compareTo in interface Comparable<Real>