Package gnu.math
Class IntFraction
- All Implemented Interfaces:
Externalizable
,Serializable
,Comparable
Implementation of exact rational numbers a ratio of two IntNums.
- See Also:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn this + k * obj.addReversed
(Numeric x, int k) Calculatex+k&this
.final int
Return an integer for which ofthis
orobj
is larger.int
final IntNum
double
The value of the real component, as a double.final boolean
long
neg()
static IntFraction
neg
(IntFraction x) final IntNum
void
final int
sign()
Return 1 if>0
; 0 if==0
; -1 if<0
; -2 ifNaN
.toString
(int radix) void
Methods inherited from class gnu.math.RatNum
add, asRatNumOrNull, classifyFinite, compare, divide, equals, equals, infinity, isExact, isZero, make, neg, power, rationalize, rneg, times, toExact, toExactInt, toInt, valueOf
Methods inherited from class gnu.math.RealNum
abs, add, angle, asBigDecimal, asRealNumOrNull, compareTo, conjugate, cos, divide, exp, im, isReal, log, max, min, re, sin, sqrt, tan, times, toExactInt, toExactInt, toInexact, toInt, toScaledInt, toScaledInt, toScaledInt, toStringDecimal, toStringScientific, toStringScientific, toStringScientific, toStringScientific, unitQuaternion, unitVector, vectorPart
Methods inherited from class gnu.math.Complex
add, colatitude, compare, complexPart, divide, equals, imMinusOne, imOne, jm, km, longitude, make, make, neg, polar, polar, power, times
Methods inherited from class gnu.math.Quaternion
add, compare, divide, doubleImagValue, doubleJmagValue, doubleKmagValue, doubleRealValue, equals, jmMinusOne, jmOne, kmMinusOne, kmOne, make, make, neg, number, polar, polar, power, times
Methods inherited from class gnu.math.Quantity
add, compare, dimensions, divide, imValue, jmValue, kmValue, make, make, make, reValue, times, unit
Methods inherited from class gnu.math.Numeric
add, asNumericOrNull, div_inv, floatValue, geq, grt, intValue, mul_ident, sub, toString
Methods inherited from class java.lang.Number
byteValue, shortValue
-
Constructor Details
-
IntFraction
-
-
Method Details
-
numerator
-
denominator
- Specified by:
denominator
in classRatNum
-
isNegative
public final boolean isNegative()- Specified by:
isNegative
in classRealNum
-
sign
public final int sign()Description copied from class:RealNum
Return 1 if>0
; 0 if==0
; -1 if<0
; -2 ifNaN
. -
compare
Description copied from class:Numeric
Return an integer for which ofthis
orobj
is larger. Return 1 ifthis>obj
; 0 ifthis==obj
; -1 ifthis<obj
; -2 ifthis!=obj
otherwise (for example if either is NaN); -3 if not comparable (incompatible types). -
compareReversed
- Overrides:
compareReversed
in classQuantity
-
add
Description copied from class:Numeric
Return this + k * obj. -
addReversed
Description copied from class:Numeric
Calculatex+k&this
.- Overrides:
addReversed
in classComplex
-
mul
-
mulReversed
- Overrides:
mulReversed
in classComplex
-
div
-
divReversed
- Overrides:
divReversed
in classComplex
-
neg
-
neg
-
longValue
public long longValue()- Overrides:
longValue
in classQuaternion
-
doubleValue
public double doubleValue()Description copied from class:Quantity
The value of the real component, as a double. This is relative to the unit().dims - i.e. unit()/doubleValue() is factored in.- Overrides:
doubleValue
in classQuaternion
-
toString
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-