public final class RationalNumber extends Number implements Scalar<RationalNumber>, NumberContext.Enforceable<RationalNumber>
Scalar.Factory<N extends Number>
ScalarOperation.Addition<T,N extends Number>, ScalarOperation.Division<T,N extends Number>, ScalarOperation.Multiplication<T,N extends Number>, ScalarOperation.Subtraction<T,N extends Number>
Modifier and Type | Field and Description |
---|---|
static Scalar.Factory<RationalNumber> |
FACTORY |
static RationalNumber |
MAX_VALUE |
static RationalNumber |
MIN_VALUE |
static RationalNumber |
NaN |
static RationalNumber |
NEG |
static RationalNumber |
NEGATIVE_INFINITY |
static RationalNumber |
ONE |
static RationalNumber |
POSITIVE_INFINITY |
static RationalNumber |
TWO |
static RationalNumber |
ZERO |
Constructor and Description |
---|
RationalNumber() |
Modifier and Type | Method and Description |
---|---|
RationalNumber |
add(double arg) |
RationalNumber |
add(RationalNumber arg) |
int |
compareTo(RationalNumber reference) |
RationalNumber |
conjugate()
This method will (most likely) be moved to some other interface in the future! Just have to figure
out where it fits...
|
RationalNumber |
divide(double arg) |
RationalNumber |
divide(RationalNumber arg) |
double |
doubleValue() |
RationalNumber |
enforce(NumberContext context) |
boolean |
equals(Object obj) |
float |
floatValue() |
RationalNumber |
get() |
int |
hashCode() |
int |
intValue() |
RationalNumber |
invert()
The multiplicative inverse.
|
boolean |
isAbsolute() |
static boolean |
isAbsolute(RationalNumber value) |
static boolean |
isInfinite(RationalNumber value) |
static boolean |
isNaN(RationalNumber value) |
boolean |
isSmall(double comparedTo) |
static boolean |
isSmall(double comparedTo,
RationalNumber value) |
long |
longValue() |
RationalNumber |
multiply(double arg) |
RationalNumber |
multiply(RationalNumber arg) |
RationalNumber |
negate()
The additive inverse of this.
|
double |
norm()
this == this.signum().multiply(this.norm()) |
static RationalNumber |
of(long numerator,
long denominator) |
static RationalNumber |
rational(double d) |
RationalNumber |
signum()
this == this.signum().multiply(this.norm()) |
RationalNumber |
subtract(double arg) |
RationalNumber |
subtract(RationalNumber arg) |
BigDecimal |
toBigDecimal() |
String |
toString() |
String |
toString(NumberContext context) |
static RationalNumber |
valueOf(double value) |
static RationalNumber |
valueOf(long value) |
static RationalNumber |
valueOf(Number number) |
byteValue, shortValue
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, divide, multiply, subtract, toPlainString
byteValue, shortValue
public static final Scalar.Factory<RationalNumber> FACTORY
public static final RationalNumber MAX_VALUE
public static final RationalNumber MIN_VALUE
public static final RationalNumber NaN
public static final RationalNumber NEG
public static final RationalNumber NEGATIVE_INFINITY
public static final RationalNumber ONE
public static final RationalNumber POSITIVE_INFINITY
public static final RationalNumber TWO
public static final RationalNumber ZERO
public static boolean isAbsolute(RationalNumber value)
public static boolean isInfinite(RationalNumber value)
public static boolean isNaN(RationalNumber value)
public static boolean isSmall(double comparedTo, RationalNumber value)
public static RationalNumber of(long numerator, long denominator)
public static RationalNumber rational(double d)
public static RationalNumber valueOf(double value)
public static RationalNumber valueOf(long value)
public static RationalNumber valueOf(Number number)
public RationalNumber add(double arg)
add
in interface ScalarOperation.Addition<Scalar<RationalNumber>,RationalNumber>
this + scalarAddend
.public RationalNumber add(RationalNumber arg)
add
in interface ScalarOperation.Addition<Scalar<RationalNumber>,RationalNumber>
this + scalarAddend
.public int compareTo(RationalNumber reference)
compareTo
in interface Comparable<RationalNumber>
public RationalNumber conjugate()
VectorSpace
This method will (most likely) be moved to some other interface in the future! Just have to figure out where it fits...
The conjugate transpose of a matrix and/or the conjugate of a scalar/field like ComplexNumber or Quaternion.
The conjugate transpose of a real matrix is simply its transpose.
conjugate
in interface VectorSpace<Scalar<RationalNumber>,RationalNumber>
public RationalNumber divide(double arg)
divide
in interface ScalarOperation.Division<Scalar<RationalNumber>,RationalNumber>
this / scalarDivisor
.public RationalNumber divide(RationalNumber arg)
divide
in interface ScalarOperation.Division<Scalar<RationalNumber>,RationalNumber>
this / scalarDivisor
.public double doubleValue()
doubleValue
in interface AccessScalar<RationalNumber>
doubleValue
in class Number
Number.doubleValue()
public RationalNumber enforce(NumberContext context)
enforce
in interface NumberContext.Enforceable<RationalNumber>
public float floatValue()
floatValue
in interface AccessScalar<RationalNumber>
floatValue
in class Number
Number.floatValue()
public RationalNumber get()
get
in interface AccessScalar<RationalNumber>
public int intValue()
intValue
in interface AccessScalar<RationalNumber>
intValue
in class Number
Number.intValue()
public RationalNumber invert()
Group.Multiplicative
invert
in interface Group.Multiplicative<Scalar<RationalNumber>>
IDENTITY / this
.public boolean isAbsolute()
isAbsolute
in interface Scalar<RationalNumber>
Scalar.isAbsolute()
public boolean isSmall(double comparedTo)
isSmall
in interface NormedVectorSpace<Scalar<RationalNumber>,RationalNumber>
comparedTo
- What to compare withpublic long longValue()
longValue
in interface AccessScalar<RationalNumber>
longValue
in class Number
Number.longValue()
public RationalNumber multiply(double arg)
multiply
in interface ScalarOperation.Multiplication<Scalar<RationalNumber>,RationalNumber>
this * scalarMultiplicand
.public RationalNumber multiply(RationalNumber arg)
multiply
in interface ScalarOperation.Multiplication<Scalar<RationalNumber>,RationalNumber>
this * multiplicand
.public RationalNumber negate()
Group.Additive
negate
in interface Group.Additive<Scalar<RationalNumber>>
-this
.public double norm()
NormedVectorSpace
this == this.signum().multiply(this.norm())
norm
in interface NormedVectorSpace<Scalar<RationalNumber>,RationalNumber>
public RationalNumber signum()
NormedVectorSpace
this == this.signum().multiply(this.norm())
signum
in interface NormedVectorSpace<Scalar<RationalNumber>,RationalNumber>
public RationalNumber subtract(double arg)
subtract
in interface ScalarOperation.Subtraction<Scalar<RationalNumber>,RationalNumber>
this - scalarSubtrahend
.public RationalNumber subtract(RationalNumber arg)
subtract
in interface ScalarOperation.Subtraction<Scalar<RationalNumber>,RationalNumber>
this - scalarSubtrahend
.public BigDecimal toBigDecimal()
toBigDecimal
in interface Scalar<RationalNumber>
public String toString(NumberContext context)
toString
in interface Scalar<RationalNumber>
Copyright © 2019 Optimatika. All rights reserved.