(12C) Decimal to Fraction
|
08-07-2018, 11:38 AM
(This post was last modified: 08-07-2018 11:51 AM by Dieter.)
Post: #6
|
|||
|
|||
RE: (12C) Decimal to Fraction
(08-07-2018 01:19 AM)Albert Chan Wrote: Can the code changed to limit size of denominator instead ? Here is a version that does it: Code: 01 STO 0 Set the max. denominator using the 12C's [n] key. Example: Approximate pi with denominators up to 100 and 200. 100 [n] 3,141592654 [R/S] => 22 [X↔Y] 7 200 [n] 3,141592654 [R/S] => 355 [X↔Y] 113 Try √2 with at most six digits in numerator plus denominator. This means the largest denominator is 999/√2 = 706,... 706 [n] 2 [√x] [R/S] => 577 [X↔Y] 408 [÷] => 1,414215686 BTW, on exit the numerator and denominator are stored in R1 and R2. The higher stack levels (Z and T) hold the next higher (better) denominator, i.e. the first one that exceeds the set limit. For the last example this is 985. Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)