(12C) Decimal to Fraction
|
08-10-2018, 12:28 PM
(This post was last modified: 08-10-2018 12:47 PM by Dieter.)
Post: #40
|
|||
|
|||
RE: (12C) Decimal to Fraction
(08-09-2018 06:38 PM)Thomas Klemm Wrote: Very nice! This is my attempt to translate your program for the HP-11C: Service: here is a translation for the 12C. Not available tests have been substituted, nmax is stored in the n-register, so that R1 is free and R2...R7 can move down to R1...R6. The output order has been reversed so that the numerator is returned in X and the denominator in Y. Code: 01 STO 0 The max. denominator is set with the [n] key. Output: numerator [X↔Y] denominator. 99 [n] 3,141592654 [R/S] => 311 [X↔Y] 99 2 [√x] [R/S] => 140 [X↔Y] 99 1 [ex] [R/S] => 193 [X↔Y] 71 20 [n] 1 [ex] [R/S] => 49 [X↔Y] 18 700 [n] 2 [√x] [R/S] => 816 [X↔Y] 577 999 [n] 3,141592654 [R/S] => 355 [X↔Y] 113 Now I wonder how long all this takes on an original hardware 12C... ;-) Note: You may replace line 23 with an x=0? test. This yields an x≤y? x=0? combination, and since x is always > 0 at this point the result logically is the desired x>y? test. ;-) Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)