[42S] looking for decimal to rational fraction
|
01-17-2019, 11:38 PM
Post: #1
|
|||
|
|||
[42S] looking for decimal to rational fraction
I was looking for a program to do decimal to fraction conversion on the 42S (well, DM42).
I found this older thread, where user Xose posts a link to his code at a now defunct website. The Internet Archive had a single copy of that page here, but it contains some odd characters, and I'm unsure how to deal with them. You can see them at the link, and here's an excerpt from the downloaded file: Code: 00 { 163-Byte Prgm } see e.g. lines 1, 13 & 20. How do I enter those? Or is the listing corrupted? thanks very much… Cambridge, UK 41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47 Casio, Rockwell 18R |
|||
01-17-2019, 11:44 PM
Post: #2
|
|||
|
|||
RE: [42S] looking for decimal to rational fraction
Ah! Comparing with the 41C prog further down the page, looks like most of them are the 42S's extended RCL commands combined with an arithmetic, e.g. RCL+
But what might the odd chars before LBL be? The 41C listing has those too… Cambridge, UK 41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47 Casio, Rockwell 18R |
|||
01-18-2019, 12:01 AM
(This post was last modified: 01-18-2019 12:02 AM by rprosperi.)
Post: #3
|
|||
|
|||
RE: [42S] looking for decimal to rational fraction
(01-17-2019 11:38 PM)cdmackay Wrote: How do I enter those? Or is the listing corrupted? I'd say they are corrupted, or at least were not recognizable when pasted into the listing. Note the 'bad' characters are not random. Every label has one, a few (but not all) RCL xx statements, plus lines 13, 20, and 70. Probably Thomas will recognize what is unique/common about the affected lines. Of course you can ignore the bad characters in the Labels and RCL lines; just skip the bad character (though for the RCL lines they could be RCL+ nn). As the original values are no longer present, it will be hard to figure out what is missing for the 3 empty lines, unless you can figure out the intended algorithm (I can't). Sorry, not much help.... --Bob Prosperi |
|||
01-18-2019, 12:17 AM
Post: #4
|
|||
|
|||
RE: [42S] looking for decimal to rational fraction
thanks Bob, it will be an exercise for me to get it working, the RCLxx bits are a good start
Cambridge, UK 41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47 Casio, Rockwell 18R |
|||
01-18-2019, 12:26 AM
Post: #5
|
|||
|
|||
RE: [42S] looking for decimal to rational fraction
(01-17-2019 11:38 PM)cdmackay Wrote: I was looking for a program to do decimal to fraction conversion on the 42S (well, DM42). Use right-click "View Frame Source" in the Chrome browser to get a better view of the source. The funny characters before the LBL are just to make the labels stand out on the listing and can be ignored. The characters on lines 13 and 20 are the 'divide' operator. Code: ****************************** — Ian Abbott |
|||
01-18-2019, 12:47 AM
Post: #6
|
|||
|
|||
RE: [42S] looking for decimal to rational fraction
You can get Ian's cleaned-up Version into the DM42 without retyping it, as follows:
First, remove the funny characters in front of the LBLs (all seven of them) and replace them with spaces. Next, find the five lines that start with +" (plus sign followed by double quote) and change those plus signs to |- (vertical bar followed by minus sign) Then, copy the program text and paste it into Free42 in PRGM mode. Check your work by making sure the pasted program has the right number of lines and bytes. You can now use Export Programs to create a raw file, which you can transfer to the DM42 and load there. |
|||
01-18-2019, 01:24 AM
Post: #7
|
|||
|
|||
RE: [42S] looking for decimal to rational fraction
(01-18-2019 12:26 AM)ijabbott Wrote: Use right-click "View Frame Source" in the Chrome browser to get a better view of the source. The funny characters before the LBL are just to make the labels stand out on the listing and can be ignored. The characters on lines 13 and 20 are the 'divide' operator. Nice tip, thanks Ian. View Frame Source works in FF as well. (01-18-2019 12:47 AM)Thomas Okken Wrote: You can get Ian's cleaned-up Version into the DM42 without retyping it, as follows: See what I mean... --Bob Prosperi |
|||
01-18-2019, 07:55 PM
Post: #8
|
|||
|
|||
RE: [42S] looking for decimal to rational fraction
thanks very much indeed Ian & Thomas, much appreciated.
Cambridge, UK 41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47 Casio, Rockwell 18R |
|||
01-18-2019, 08:20 PM
Post: #9
|
|||
|
|||
RE: [42S] looking for decimal to rational fraction
(01-18-2019 12:47 AM)Thomas Okken Wrote: … Alternatively for those without Free42 to hand [why not? ] this decoder also works perfectly (once Thomas's corrections are made): https://www.swissmicros.com/dm42/decoder/ Cambridge, UK 41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47 Casio, Rockwell 18R |
|||
01-18-2019, 08:36 PM
Post: #10
|
|||
|
|||
RE: [42S] looking for decimal to rational fraction
hmm. although it works perfectly on Free42 Decimal Mac, it gets a Size Error on Free42 Android, and Invalid Type on DM42.
further assembly required… Cambridge, UK 41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47 Casio, Rockwell 18R |
|||
01-18-2019, 09:18 PM
(This post was last modified: 01-18-2019 09:36 PM by cdmackay.)
Post: #11
|
|||
|
|||
RE: [42S] looking for decimal to rational fraction
There were two problems: first, on my Free42 Android, somehow the REGS matrix had disappeared, causing the Size Error. A SIZE 25 sorted that out.
However, the program appears to be a little brittle regarding the stack contents when it starts. It starts by jumping to LBL 11, which saves the stack contents into R07–R10: Code: 01 LBL "FRACT" and it restores them when it's done. Unfortunately, those STO fail if there's something on the stack that can't be saved into a register, causing the Invalid Type. For example, a matrix, if you've just done a SIZE 25 That's fixed by putting some reals on the stack first. Normally not likely to be an issue, but not ideal. Cambridge, UK 41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47 Casio, Rockwell 18R |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)