Package org.midheaven.math
Interface Rational
- All Superinterfaces:
AdditionGroup<Rational>,AdditionMonoid<Rational>,Comparable<Rational>,Field<Rational>,LongOrdered,MultiplicationGroup<Rational>,MultiplicationMonoid<Rational>,Ordered<Rational>,Signed<Rational>
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault Rationalabs()Returns the absolute value of this instance.static Arithmetic<Rational, Rational> ceil()cube()booleanfloor()static RationalinthashCode()default booleandefault booleanisOne()Checks whether is One.booleanisWhole()booleanisZero()Tests if this value is zero.default Rationalminus(long other) default Rationalstatic Rationalof(long numerator) static Rationalof(long numerator, long denominator) static Rationalof(BigDecimal decimal) static Rationalof(BigInteger numerator) static Rationalof(BigInteger numerator, BigInteger denominator) default Rationalover(long other) default Rationalstatic Rationaldefault Rationalplus(long other) default RationalraisedTo(int exponent) square()default Rationaltimes(long other) longtoLong()The equivalentLongvalue.Methods inherited from interface org.midheaven.math.AdditionGroup
negateMethods inherited from interface org.midheaven.math.AdditionMonoid
plusMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface org.midheaven.lang.LongOrdered
compareTo, isEqualTo, isGreaterThan, isGreaterThanOrEqualTo, isLessThan, isLessThanOrEqualToMethods inherited from interface org.midheaven.math.MultiplicationGroup
invertMethods inherited from interface org.midheaven.math.MultiplicationMonoid
timesMethods inherited from interface org.midheaven.lang.Ordered
isEqualTo, isGreaterThan, isGreaterThanOrEqualTo, isLessThan, isLessThanOrEqualToMethods inherited from interface org.midheaven.lang.Signed
isNegative, isPositive, negate, sign
-
Field Details
-
ZERO
-
ONE
-
NEGATIVE_ONE
-
TEN
-
PI
-
-
Method Details
-
arithmetic
-
of
-
of
-
of
-
of
-
of
-
parse
-
from
-
equals
-
hashCode
int hashCode() -
plus
-
minus
- Specified by:
minusin interfaceAdditionGroup<Rational>
-
minus
-
times
-
over
- Specified by:
overin interfaceMultiplicationGroup<Rational>
-
over
-
abs
Description copied from interface:SignedReturns the absolute value of this instance.- Specified by:
absin interfaceAdditionGroup<Rational>- Specified by:
absin interfaceSigned<Rational>- Returns:
Signed.negate()when this value is negative; otherwise this instance
-
numerator
Int numerator() -
denominator
Int denominator() -
square
Rational square() -
cube
Rational cube() -
toBigDecimal
BigDecimal toBigDecimal() -
toLong
long toLong()The equivalentLongvalue. This is equivalent to divide the numerator by the denominator using long division, discarding the remainder. IfisWhole()istrue, and the value fits in a Long, this value is the numerator.- Returns:
- the equivalent long value.
-
floor
Rational floor() -
ceil
Rational ceil() -
isWhole
boolean isWhole() -
raisedTo
-
isNegativeOne
default boolean isNegativeOne() -
isOne
default boolean isOne()Description copied from interface:MultiplicationMonoidChecks whether is One.- Specified by:
isOnein interfaceMultiplicationMonoid<Rational>- Returns:
- the result of isOne
-
isZero
boolean isZero()Description copied from interface:SignedTests if this value is zero.- Specified by:
isZeroin interfaceAdditionMonoid<Rational>- Specified by:
isZeroin interfaceSigned<Rational>- Returns:
trueifSigned.sign()returns0;falseotherwise
-
increment
Rational increment() -
decrement
Rational decrement()
-