Hi,
how to program an "AND" of two flags? I can come up only with
0
FS? 0
1
FS? 1
1
*
X!=0?
Is there a better way?
Thanks, Peter.
Programming "AND" of two flags in the non RPL machines
|
08-22-2007, 11:06 PM
Hi, how to program an "AND" of two flags? I can come up only with
0 Is there a better way? Thanks, Peter.
08-22-2007, 11:11 PM
Slightly smaller is:
PI
08-23-2007, 08:59 AM
Hi, Peter: Peter asked:
FC? 01 You can exchange flag 00 for flag 01 in the above solution if you can't afford clearing flag 00 but don't mind clearing flag 01 instead. Also, not only is my solution shorter, but significantly faster as well and the cherry on top is that it also preserves the whole RPN stack, LASTX included. Best regards from V.
Edited: 23 Aug 2007, 9:10 a.m. after one or more responses were posted
08-23-2007, 09:05 AM
I guess I not understand something. What is flag checking?
08-23-2007, 09:19 AM
Hi Vincze. Edited: 23 Aug 2007, 9:20 a.m.
08-23-2007, 09:30 AM
I guess I more interested in what is flag setting all about. I know of 15C, there is flag setting to enter complex mode. But on 35s, I not understand when book says flags 0 - 4 mean whatever you want them to mean. Is it like it store boolean value for later use?
08-23-2007, 09:49 AM
Exactly. Flags are just boolean values. On the 35s, flags 0-4 happen to have their state displayed in the annunciator area, which makes them useful to visually indicate some sort of status. Some flags are also used to control settings of the calculator, such as setting flag 10 to inhibit equation evaluation. Stefan
08-23-2007, 09:56 AM
Another solution that preserves the stack and LASTx uses a third flag. So if you're testing flags 0 and 1, the following will set flag 2 to the AND of flags 0 and 1, and then test the result:
SF 2 Likewise, the following does OR:
CF 2 Alternatively, if all you're interested in is branching somewhere if the AND is true, you could write:
FC? 0 Stefan
08-23-2007, 02:54 PM
Had one only FC? on the 3Xs machines... (where X=2,3,5). Thanks for these answers! Learnt something for today and should go home. Cheers, Peter. |
« Next Oldest | Next Newest »
|