All Packages Class Hierarchy This Package Previous Next Index
Class prolog.math.IntFraction
java.lang.Object
|
+----prolog.Term
|
+----prolog.math.Numeric
|
+----prolog.math.RatNum
|
+----prolog.math.IntFraction
- public class IntFraction
- extends RatNum
Maths package for Prolog. A stripped and modified version of the gnu.math
library, which has the following copyright:
Copyright (c) 1997 Per M.A. Bothner.
This is free software; for terms and warranty disclaimer see ./COPYING.
Implementation of exact rational numbers as fractions of IntNums.
-
den
-
-
num
-
-
IntFraction(IntNum, IntNum)
-
-
add(Numeric, int)
- Return this + k * obj.
-
add_reversed(Numeric, int)
- Calculate x + k & this.
-
compare(Numeric)
- Return 1 if this>obj; 0 if this==obj; -1 if this<obj; -2 if
either is NaN; -3 if not comparable (not equal).
-
compare_reversed(Numeric)
-
-
denominator()
-
-
div(Numeric)
-
-
div_reversed(Numeric)
-
-
doubleValue()
-
-
hashCode()
- Every Numeric subclass must provide a hashCode
method such that numbers that are equal return the same hash.
-
isNegative()
-
-
longValue()
-
-
mod(Numeric)
-
-
mul(Numeric)
-
-
mul_reversed(Numeric)
-
-
neg()
-
-
neg(IntFraction)
-
-
numerator()
-
-
sign()
-
-
toString(int)
-
num
IntNum num
den
IntNum den
IntFraction
IntFraction(IntNum num,
IntNum den)
numerator
public final IntNum numerator()
- Overrides:
- numerator in class RatNum
denominator
public final IntNum denominator()
- Overrides:
- denominator in class RatNum
isNegative
public final boolean isNegative()
- Overrides:
- isNegative in class Numeric
sign
public final int sign()
- Overrides:
- sign in class Numeric
compare
public final int compare(Numeric n)
- Return 1 if this>obj; 0 if this==obj; -1 if this<obj; -2 if
either is NaN; -3 if not comparable (not equal).
- Overrides:
- compare in class Numeric
compare_reversed
public int compare_reversed(Numeric x)
- Overrides:
- compare_reversed in class Numeric
add
public Numeric add(Numeric y,
int k)
- Return this + k * obj.
- Overrides:
- add in class Numeric
add_reversed
public Numeric add_reversed(Numeric x,
int k)
- Calculate x + k & this.
- Overrides:
- add_reversed in class Numeric
mul
public Numeric mul(Numeric y)
- Overrides:
- mul in class Numeric
mul_reversed
public Numeric mul_reversed(Numeric x)
- Overrides:
- mul_reversed in class Numeric
div
public Numeric div(Numeric y)
- Overrides:
- div in class Numeric
div_reversed
public Numeric div_reversed(Numeric x)
- Overrides:
- div_reversed in class Numeric
mod
public Numeric mod(Numeric y)
- Overrides:
- mod in class Numeric
neg
public static IntFraction neg(IntFraction x)
neg
public Numeric neg()
- Overrides:
- neg in class Numeric
longValue
public long longValue()
- Overrides:
- longValue in class Numeric
doubleValue
public double doubleValue()
- Overrides:
- doubleValue in class Numeric
toString
public String toString(int radix)
- Overrides:
- toString in class Numeric
hashCode
public int hashCode()
- Every Numeric subclass must provide a hashCode
method such that numbers that are equal return the same hash.
- Overrides:
- hashCode in class Numeric
All Packages Class Hierarchy This Package Previous Next Index