Part 1: Naive implementation
|
The file RAT.h is the interface. It lists
the functions (and their prototypes) that your client program can use.
The file RATtest.c is a sample client
program that uses the interface functions to perform rational
arithmetic.
Your first task
is to write an implementation file rat.c,
that implements the functions described in RAT.h
so that client programs like RATtest.c can use it
as a black box.
In this part you will write a client program e.c
that computes a rational approximation to the mathematical
constant e using the Taylor
expansion e = 1/0! + 1/1! + 1/2! + 1/3! + . . .
Part 3: Improved implementation
|
In this part you will write a better version of the
rat.c implementation that you wrote in Part 1.
The goal here is to stave off overflow by being a bit more
clever.
Kevin Wayne