Help with an algorithm for converting decimals to fractions
08-27-2014, 08:55 PM (This post was last modified: 08-27-2014 08:56 PM by Namir.)
Post: #1 Namir Senior Member Posts: 907 Joined: Dec 2013
Help with an algorithm for converting decimals to fractions
I posted an HP Prime program that calculates the integer fractions that approximate a number with decimals (for a user-specified number of continued fraction coefficients). See the HP Prime listing if my description is ambiguous. The program uses an array to store the coefficients of the continued fraction. The program then uses the values in this array to calculate the final numerator and denominator that approximate the input decimal value.

The Math Pac for the HP-7 has a program that performs a similar task. I believe it does its task WITHOUT using an array to store the coefficients of the continued fraction!!

My question to you all (and especially Jo Horn) is, "What is the algorithm that converts decimals to fractions that does not use an array to store the coefficients of the continued fraction. I will be happy if you give me a general algorithm.