Text File | 1994-11-09 | 636 b | 12 lines | [ttro/ttxt]
'continued_fraction' is a C++ class for computing best rational approximations of floating point numbers. The class is called 'continued_fraction' because the approximations are computed using continued fractions.
'continued_fraction' can be used to pretty-print numbers. For instance, one can use them to print 1.5 as 3/2. Implementing this in a useful way does require a lot of work, though.
The accompanying program demonstrates its use.
For details about continued fractions and rational approximations consult a
book on number theory (number theory is a branch of mathematics)