I want to use the RAT function to find the fractional representation of a floating point number. However, the results that I receive are not the smallest possible set of numbers.
For example when I use RAT on the following number
[a b] = rat(3.1415926535, 8000e-6)
It gives me the numerator and denominator coefficients as
a = 22 b = 7
Now compute the relative error between the floating point number used above and the ratio 19/6
c = (19/6-3.1415926535)/3.1415926535 .
This results in c = 0.007981306277481 which is lesser than the tolerance value of 0.008.
Best Answer