Post Reply 
[42S] looking for decimal to rational fraction
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"
02 XEQ 11

91 LBL 11
92 STO 10
93 Rv
94 STO 09
95 Rv
96 STO 08
97 Rv
98 STO 07
99 Rv
100 RTN

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 Smile

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
Casio, Rockwell 18R
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [42S] looking for decimal to rational fraction - cdmackay - 01-18-2019 09:18 PM



User(s) browsing this thread: 1 Guest(s)