Decimals to improper fractions program?
|
06-07-2018, 08:58 AM
(This post was last modified: 06-07-2018 09:56 AM by Dieter.)
Post: #10
|
|||
|
|||
RE: Decimals to improper fractions program?
(06-06-2018 09:12 PM)Dieter Wrote: The 15C version on that website looks more promising. Here is an adapted (and slightly tweaked) version for the 35s: Here is an improved version for the 35s that uses two more data registers, but when the program stops to display the current fraction the stack does not have to be preserved. So this version is safer to use. And it allows an additional feature: You can always press the [÷] key to see the approximated value. The upper display line then shows the input so that you can compare both values easily. I also added an x≠0? test to avoid a zero division error if the fraction exactly matches the input. Code: F001 LBL F When the fraction agrees with the input the next [R/S] now just exits the program with two zeros in the display. If you don't like this replace the final CLSTK with GTO F026, so that after another [R/S] the last fraction is displayed once again. You may also replace all lines from F031 to the end with GTO F008. This will return even more fractions that are even more exact than the previous ones, although the 35s' 12-digit precision cannot show this. At any time the numerator and denominator can be recalled with RCL A and RCL B. The original algorithm does not work for input < 1. In such a case you may enter 1/x and swap numerator and denominator. I now have edited the program so that – I think – this issue is fixed. Try it and see if it works. The program also works for negative input. Here the minus sign is returned once in the numerator and once in the denominator. Example: 10 [√x] XEQ F [ENTER] 3 1 [R/S] 19 6 [R/S] 117 37 [R/S] 721 228 Check accuracy now: [÷] 3,16227766017 3,16228070175 Continue: [R/S] 4443 1405 ... Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)