Example 1:
> pi10 = rationalapprox(Pi,10);
> pi50 = rationalapprox(Pi,50);
> pi100 = rationalapprox(Pi,100);
> print( pi10, ": ", simplify(floor(-log2(abs(pi10-Pi)/Pi))), "bits." );
3.140625 : 11 bits.
> print( pi50, ": ", simplify(floor(-log2(abs(pi50-Pi)/Pi))), "bits." );
85563208 / 27235615 : 51 bits.
> print( pi100, ": ", simplify(floor(-log2(abs(pi100-Pi)/Pi))), "bits." );
4422001152019829 / 1407566683404023 : 100 bits.
Example 2:
> a=0.1;
> b=rationalapprox(a,4);
> numerator(b); denominator(b);
1
10
> print(simplify(floor(-log2(abs((b-a)/a)))), "bits.");
166 bits.