rational numbers

Martin Wierich martinw@cs.kun.nl
Mon, 06 Dec 1999 12:28:26 +0100


Hi Clifford,

We have a prototype of a module for exact rationals lying around here in
Nijmegen. Such a module should be
based on arbitrary length integers ("BigInts") which I am currently
implementing. When this will be
finished we will release these modules. For those who want to know: the
BigInt implementation will be
based on the GNU GMP library. To speed up calculation with small numbers
we add new instrucions to the ABC
machine, e.g. an instruction that returns both the result of adding two
32 bit integers and a Boolean that
says whether an overflow occured.

Martin Wierich
University of Nijmegen

"Clifford J. Nelson" wrote:

> Are there any Clean examples in books or on the web that implement the
exact rational number data type
> with overloading of all appropriate arithmetic operations and
conversion to and from other number
> types, all in Clean without anything relating to the platform it will
run on? It goes without saying
> that it is too difficult to predict the number of digits that the
numerator and denominator need to
> have, so, available memory should be the only limit to their size.
>
>   Cliff Nelson