Post Reply 
Power-of-two fraction handling for the 41C
02-01-2016, 09:10 PM (This post was last modified: 02-01-2016 09:38 PM by Dieter.)
Post: #11
RE: Power-of-two fraction handling for the 41C
(02-01-2016 06:47 PM)quantalume Wrote:  Well, it would be easy enough to put a RCL d, STO 01 at the start of the program. However, by doing a RCL 01, STO d after the last ARCL, I lose one of the results off the top of the stack that Dieter is returning. It could be done, but it messes up his elegant program.

The problem is not the messed up stack – this can be avoided by using X<> commands. The problem is that both RCL and X<> normalize numbers, so that the original content of register d that was saved here, is altered before it can be stored back in d. This does not happen on the stack or in status registers, but the complete stack is used by the program.

Hmmm... there might be a way. The program could set/clear flags 0...3 so that the first nibble of d becomes 1001, indicating this is an alpha string. Which might avoid the normalisation procedure. Maybe the experts can say more here.

Another option is changing the program so that it uses one additional data register while d is kept on the stack. I think this should work.

Anyway, I just added support for improper fractions. Since the program so far does not handle negative input, an ABS at the start also makes sense (just to be sure...).

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Power-of-two fraction handling for the 41C - Dieter - 02-01-2016 09:10 PM



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