Posts: 3,229
Threads: 42
Joined: Jul 2006
Slightly smaller is:
PI
FS? 0
IP ; Integer part
FS? 1
FP ; Fractional part
x=0?
- Pauli
Posts: 1,755
Threads: 112
Joined: Jan 2005
Hi, Peter:
Peter asked:
"How to program an "AND" of two flags? I can come up only with [... (a 7-step solution) ...] Is there a better way?
If your program is intended to run in an HP-41C/CV/CX, an HP42S, or some suitably compatible model or emulation, and you don't care for the status of flag 00 (or 01) after the test, I can come up with a 3-step solution, namely:
FC? 01
CF 00
FS? 00
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