Package gnu.math
Class IntFraction
-
- All Implemented Interfaces:
Externalizable,Serializable,Comparable
public class IntFraction extends RatNum implements Externalizable
Implementation of exact rational numbers a ratio of two IntNums.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description IntFraction(IntNum num, IntNum den)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Numericadd(Object y, int k)Return this + k * obj.NumericaddReversed(Numeric x, int k)Calculatex+k&this.intcompare(Object obj)Return an integer for which ofthisorobjis larger.intcompareReversed(Numeric x)IntNumdenominator()Numericdiv(Object y)NumericdivReversed(Numeric x)doubledoubleValue()The value of the real component, as a double.booleanisNegative()longlongValue()Numericmul(Object y)NumericmulReversed(Numeric x)Numericneg()static IntFractionneg(IntFraction x)IntNumnumerator()voidreadExternal(ObjectInput in)intsign()Return 1 if>0; 0 if==0; -1 if<0; -2 ifNaN.StringtoString(int radix)voidwriteExternal(ObjectOutput out)-
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
-
-
-
-
Method Detail
-
denominator
public final IntNum denominator()
- Specified by:
denominatorin classRatNum
-
isNegative
public final boolean isNegative()
- Specified by:
isNegativein classRealNum
-
sign
public final int sign()
Description copied from class:RealNumReturn 1 if>0; 0 if==0; -1 if<0; -2 ifNaN.
-
compare
public final int compare(Object obj)
Description copied from class:NumericReturn an integer for which ofthisorobjis larger. Return 1 ifthis>obj; 0 ifthis==obj; -1 ifthis<obj; -2 ifthis!=objotherwise (for example if either is NaN); -3 if not comparable (incompatible types).
-
compareReversed
public int compareReversed(Numeric x)
- Overrides:
compareReversedin classQuantity
-
add
public Numeric add(Object y, int k)
Description copied from class:NumericReturn this + k * obj.
-
addReversed
public Numeric addReversed(Numeric x, int k)
Description copied from class:NumericCalculatex+k&this.- Overrides:
addReversedin classComplex
-
mulReversed
public Numeric mulReversed(Numeric x)
- Overrides:
mulReversedin classComplex
-
divReversed
public Numeric divReversed(Numeric x)
- Overrides:
divReversedin classComplex
-
neg
public static IntFraction neg(IntFraction x)
-
longValue
public long longValue()
- Overrides:
longValuein classQuaternion
-
doubleValue
public double doubleValue()
Description copied from class:QuantityThe value of the real component, as a double. This is relative to the unit().dims - i.e. unit()/doubleValue() is factored in.- Overrides:
doubleValuein classQuaternion
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
-