A Subroutine for Computations with Rational Numbers

1. Introduction Modern digital high-speed computation is unthinkable without the possibility of representing numbers by decimals. At the same time, the inherent error introduced by the representation of all numbers by a terminating decimal (or binary) fraction is a permanent source of some highly irritating features of digital computation. Numerical instability, loss of accuracy arising by subtraction of two nearly equal numbers, and round-off errors in general are a consequence of this ever-present inaccuracy. Little attention seems to have been paid to the simple idea that perfect accuracy is possible on a computing machine if the computations are performed in the field of rational numbers, that is, in the realm of fractions with integral numerator and denominator. For most standard applications of automatic computers in numerical analysis computation in the rational field is not feasible, since the integers in both numerator and denominator would grow too rapidly and soon exceed the capacity of the machine. There exists, however, a small class of problems which call for rational computation. One is the automatization of formal computations with power series with rational coefficients (see the paper immediately following this); another possible application is the computation of the coefficients in ce~ain high-order interpolation and differentiation formulas. We wish to describe in this paper a subroutine for calculations with rationals which was designed :specifically for SEAC (the National Bureau of Standards Eastern Automatic Computer). The essential features of our routine could also be realized on most other computers.