Help with an algorithm for converting decimals to fractions
|
08-28-2014, 06:48 AM
(This post was last modified: 08-28-2014 06:49 AM by Joe Horn.)
Post: #6
|
|||
|
|||
RE: Help with an algorithm for converting decimals to fractions
Here's a little HP 50g program that is a demo of the algorithm for converting a decimal into a fraction without storing the partial quotients of the expanded continued fraction.
Instructions: (1) Clear the stack. Put calculator in exact mode. (2) Place on level 1 of the stack either a decimal number, or an algebraic ratio of two integers, e.g. '123/234'. (3) Run the program repeatedly. Stop when level 4 shows infinity. Each iteration will display the following on the stack: 4: Current value of N. Stop when it's infinity. 3: Previous Convergent p/q in the form of { p q } 2: Current Convergent a/b in the form { a b } 1: Decimal evaluation of a/b Warning: Program must be loaded and run in exact mode. 'ITER8' ("Iterate") by Joe Horn Code: %%HP: T(3)A(R)F(.); <0|ΙΈ|0> -Joe- |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Help with an algorithm for converting decimals to fractions - Namir - 08-27-2014, 08:55 PM
RE: Help with an algorithm for converting decimals to fractions - Paul Dale - 08-27-2014, 10:12 PM
RE: Help with an algorithm for converting decimals to fractions - Thomas Klemm - 08-27-2014, 10:32 PM
RE: Help with an algorithm for converting decimals to fractions - CosmicTruth - 08-28-2014, 12:51 AM
RE: Help with an algorithm for converting decimals to fractions - Joe Horn - 08-28-2014, 06:03 AM
RE: Help with an algorithm for converting decimals to fractions - Joe Horn - 08-28-2014 06:48 AM
|
User(s) browsing this thread: 1 Guest(s)