Decimals to improper fractions program?
|
06-06-2018, 09:12 PM
(This post was last modified: 06-06-2018 10:15 PM by Dieter.)
Post: #7
|
|||
|
|||
RE: Decimals to improper fractions program?
(06-06-2018 04:33 PM)Oddballs Wrote: I tried to use this program [NB: from another website ] on my HP35s but i get the invlaid (I) error. Does anyone have a clue whats wrong with the code? First of all: check the code twice. Then check it once again. Compare each and every single line in your program with the listing. STO I is different from STO (I). Looking at the code I think several GTOs and XEQs are wrong: Some lines are printed in green color, these seem to be the intended jump targets. But then F014 says XEQ F034 while XEQ F033 would make more sense. Line F025 is marked in green but then line F020 says GTO F026. IMHO the lines with GTOs and XEQs should read like this: F014 XEQ F033 F020 GTO F025 F024 GTO F011 F045 GTO F038 I would also replace the PSE at the end with a R/S so that you have time to read and write down the different approximations. Please double-check the mentioned program lines as the 35s may automatically renumber jump targets while you edit the program. After these changes the program runs just fine. EDIT: The 15C version on that website looks more promising. Here is an adapted (and slightly tweaked) version for the 35s: Code: F001 LBL F [pi] XEQ F [ENTER] 3 1 [R/S] 22 7 [R/S] 333 106 [R/S] 355 113 ... As soon as the fractional approximation exactly equals the input (within 12 digits, that is) the final fraction is returned with negative signs: [R/S] –1146408 –364913 This way you know the program has finished and no further fractions can be expected. ;-) Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)