Post Reply 
Power-of-two fraction handling for the 41C
02-01-2016, 05:43 PM (This post was last modified: 02-01-2016 06:18 PM by quantalume.)
Post: #7
RE: Power-of-two fraction handling for the 41C
OK, here is what I came up with. I avoided looking at your solution before I was finished.

Code:
01 LBL "TOF"
02 ENTER
03 FIX 0
04 INT
05 CLA
06 ARCL X
07 RDN
08 FRC
09 RCL 00
10 STO 01
11 *
12 0.5
13 X>Y?
14 GTO 04
15 RDN
16 FC? 04
17 GTO 02
18 ENTER
19 GTO 03
20 LBL 01
21 RDN
22 LBL 02
23 ENTER
24 RND
25 2
26 MOD
27 X≠0?
28 GTO 03
29 2
30 ST/ 01
31 RDN
32 RDN
33 2
34 /
35 GTO 02
36 LBL 03
37 RDN
38 "├ "
39 ARCL X
40 "├/"
41 ARCL 01
42 LBL 04
43 AVIEW
44 END

I like your solution better as it is shorter, doesn't use an extra register and leaves the stack in a more-desirable state. You also take advantage of flag 29 to eliminate the decimal mark from the result. The only thing nice to add would be saving and recalling flag register d in order to return the calculator to the original mode setting, rather than assuming it was in FIX 4.

David Brunell
Houston, Texas
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 - quantalume - 02-01-2016 05:43 PM



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