Decimal to fraction

In a recent video, Professor Rhett Allain demonstrates how to use mediants to convert real numbers into fractions. He explains that the mediant of two fractions is simply the sum of their numerators divided by the sum of their denominators. By using this property, he is able to estimate the decimal portion of a real number as a fraction. However, there are a couple of oddities in his code. The numerator and denominator are given in exponential form and rounded to six digits, so we don’t see the final digit of either. Additionally, his denominator is much larger than necessary. In contrast, continued fractions provide a simpler and more accurate fractional representation of a real number. Professor Allain used the example of estimating Pi to illustrate the power of continued fractions.

https://leancrew.com/all-this/2023/08/decimal-to-fraction/

To top