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.


Constructor Index

 o RatNum()

Method Index

 o add(RatNum, RatNum, int)
 o compare(RatNum, RatNum)
 o denominator()
 o divide(RatNum, RatNum)
 o equals(Object)
 o equals(RatNum, RatNum)
 o infinity(int)
Return exact "rational" infinity.
 o isExact()
 o isZero()
 o make(IntNum, IntNum)
 o numerator()
 o power(IntNum)
Return this raised to an integer power.
 o rationalize(Numeric, Numeric)
Calcaulte the simplest rational between two reals.
 o times(RatNum, RatNum)
 o toExact()
Convert to an exact number.
 o toExactInt(int)
 o toInt(int)
Converts a real to an integer, according to a specified rounding mode.

Constructors

 o RatNum
 public RatNum()

Methods

 o numerator
 public abstract IntNum numerator()
 o denominator
 public abstract IntNum denominator()
 o make
 public static RatNum make(IntNum num,
                           IntNum den)
 o isExact
 public boolean isExact()
Overrides:
isExact in class Numeric
 o isZero
 public boolean isZero()
Overrides:
isZero in class Numeric
 o infinity
 public static RatNum infinity(int sign)
Return exact "rational" infinity.

Parameters:
sign - either 1 or -1 for positive or negative infinity
 o compare
 public static int compare(RatNum x,
                           RatNum y)
 o equals
 public static boolean equals(RatNum x,
                              RatNum y)
 o equals
 public boolean equals(Object obj)
Overrides:
equals in class Numeric
 o add
 public static RatNum add(RatNum x,
                          RatNum y,
                          int k)
 o times
 public static RatNum times(RatNum x,
                            RatNum y)
 o divide
 public static RatNum divide(RatNum x,
                             RatNum y)
 o power
 public Numeric power(IntNum y)
Return this raised to an integer power.

Overrides:
power in class Numeric
 o toExact
 public final RatNum toExact()
Convert to an exact number.

Overrides:
toExact in class Numeric
 o toInt
 public Numeric toInt(int rounding_mode)
Converts a real to an integer, according to a specified rounding mode.

Overrides:
toInt in class Numeric
 o toExactInt
 public IntNum toExactInt(int rounding_mode)
 o 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