All Packages Class Hierarchy This Package Previous Next Index
Class prolog.math.RatNum
java.lang.Object
|
+----prolog.Term
|
+----prolog.math.Numeric
|
+----prolog.math.RatNum
- public abstract class RatNum
- extends Numeric
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.
The abstract class of rational numbers.
-
RatNum()
-
-
add(RatNum, RatNum, int)
-
-
compare(RatNum, RatNum)
-
-
denominator()
-
-
divide(RatNum, RatNum)
-
-
equals(Object)
-
-
equals(RatNum, RatNum)
-
-
infinity(int)
- Return exact "rational" infinity.
-
isExact()
-
-
isZero()
-
-
make(IntNum, IntNum)
-
-
numerator()
-
-
power(IntNum)
- Return this raised to an integer power.
-
rationalize(Numeric, Numeric)
- Calcaulte the simplest rational between two reals.
-
times(RatNum, RatNum)
-
-
toExact()
- Convert to an exact number.
-
toExactInt(int)
-
-
toInt(int)
- Converts a real to an integer, according to a specified rounding
mode.
RatNum
public RatNum()
numerator
public abstract IntNum numerator()
denominator
public abstract IntNum denominator()
make
public static RatNum make(IntNum num,
IntNum den)
isExact
public boolean isExact()
- Overrides:
- isExact in class Numeric
isZero
public boolean isZero()
- Overrides:
- isZero in class Numeric
infinity
public static RatNum infinity(int sign)
- Return exact "rational" infinity.
- Parameters:
- sign - either 1 or -1 for positive or negative infinity
compare
public static int compare(RatNum x,
RatNum y)
equals
public static boolean equals(RatNum x,
RatNum y)
equals
public boolean equals(Object obj)
- Overrides:
- equals in class Numeric
add
public static RatNum add(RatNum x,
RatNum y,
int k)
times
public static RatNum times(RatNum x,
RatNum y)
divide
public static RatNum divide(RatNum x,
RatNum y)
power
public Numeric power(IntNum y)
- Return this raised to an integer power.
- Overrides:
- power in class Numeric
toExact
public final RatNum toExact()
- Convert to an exact number.
- Overrides:
- toExact in class Numeric
toInt
public Numeric toInt(int rounding_mode)
- Converts a real to an integer, according to a specified rounding
mode.
- Overrides:
- toInt in class Numeric
toExactInt
public IntNum toExactInt(int rounding_mode)
rationalize
public static Numeric rationalize(Numeric x,
Numeric y)
- Calcaulte the simplest rational between two reals.
All Packages Class Hierarchy This Package Previous Next Index