Fraction Approximation Calculator
A JavaScript web page for finding fractional approximations to values.
©2006, Bob Beeman
Updated
Read More www.bee-man.us Important Notice

This calculator attempts to find the best fractional approximation to some decimal value using integer values for the numerator and denominator.

Use of the calculator is as follows:

Action Press the "Start" button to begin the calculation.
Value Enter the decimal value of the number to be approximated. This can be up to 17 characters, including the decimal point. It is always interpreted as a positive number.
Limit The maximum value allowed for the numerator and denominator of the approximating fraction.
CAUTION: Don't enter numbers larger than 10,000 unless you are willing to allow very long run times, and then only if the "Only Better" box is checked. Otherwise your browser's textbox maximum may be over-run.
Display If the "Only Better" check box is checked, fractional approximations will be displayed only if they represent an improvement over previous values. Otherwise, all values will be displayed.
Output The values in the bottom text field are numerator, denominator, and the value entered minus the value of the fraction represented by the numerator and denominator.

Rational Fraction Approximation Calculator
Action Value Limit Display
Only Better

Interesting numbers to approximate
Pi e Golden Ratio Sqrt(2)
3.141592653589793 2.718281828459 1.61803398875 1.414213562373

Read More
This calculator starts with a numerator of 1 and a denominator of 1. It performs the division, giving an initial approximation of one. It then calculates the value minus the approximation (the fraction), giving a difference. If the difference is positive, the numerator is increased by one for the next trial. If the difference is negative, the denominator is increased by one for the next trial. This continues until the limit is reached by the numerator or denominator.

Most of the work is in formatting the output. This is true for a lot of software packages.


This page is copyrighted "freeware"
©2006, Bob Beeman
www.bee-man.us
That means that although it is copyrighted, it is intended for you to use for education or entertainment. You may use it yourself, copy and redistribute it, or even put it on your own website. I ask only that you not make any changes. If you reuse any of the code, make sure to list me as one of your sources.

My only reward for writing this is the 15 milliseconds of fame I receive from having my name here. Don't deprive me of that.

You can copy this page by simply doing a "Save As" in your browser and putting it somewhere on your hard drive (or your web site). If you stop there the background will be gone. To preserve the background, copy the following file into this same folder, without changing its name, by again using your browser's "Save As". The next time you refresh the page, the background should be restored:

www_bee-man_us_background.gif

I make NO guarantee of any kind.
This page may contain serious errors.
Use this page entirely at your own risk!