Comparisons with zero on HP65

08282017, 09:30 PM
(This post was last modified: 08292017 12:16 AM by Matt Agajanian.)
Post: #1




Comparisons with zero on HP65
Hi all.
The HP65's looping and branching were (and still are) quite functional and powerful. Although only comparisons between X and Y were available, outside of putting zero on the stack, what are some other ways to accomplish comparisons between X and zero? What are some ways to achieve X and 0 comparisons which streamline program steps? Thanks 

08292017, 10:01 PM
Post: #2




RE: Comparisons with zero on HP65
(08282017 09:30 PM)Matt Agajanian Wrote: What are some ways to achieve X and 0 comparisons which streamline program steps? "Some ways"? I wonder if there is even one single way to compare X with 0 without placing a zero in X or Y. The HP65 does not have tests that compare X with 0. So any method to do so has to use at least two steps. This means that "0 X=Y?" (resp. other tests) is as short as it gets. More streamlining simply is not possible. But I'll be glad if you prove me wrong. ;) Dieter 

08292017, 10:14 PM
(This post was last modified: 08292017 10:15 PM by Matt Agajanian.)
Post: #3




RE: Comparisons with zero on HP65
(08292017 10:01 PM)Dieter Wrote:(08282017 09:30 PM)Matt Agajanian Wrote: What are some ways to achieve X and 0 comparisons which streamline program steps? Nope! But, I just thought I'd ask and see if our group had clever shortcuts to allow X to stay in the X register instead of being pushed into Y. But yes, that's about the shortest shortcut there is. Thanks 

08292017, 10:20 PM
(This post was last modified: 08292017 10:22 PM by Dieter.)
Post: #4




RE: Comparisons with zero on HP65
(08292017 10:14 PM)Matt Agajanian Wrote: Nope! But, I just thought I'd ask and see if our group had clever shortcuts to allow X to stay in the X register instead of being pushed into Y. X doesn't have to get pushed to Y. You can always add another step and add an X<>Y. Or you simply place the zero before the value which is compared to 0 is calculated: Instead of... Code: RCL 1 ...simply do it this way: Code: 0 Dieter 

08292017, 10:32 PM
Post: #5




RE: Comparisons with zero on HP65
How about:
Code: e^x Works for small values of x (227 <= x <= 222). Ceci n'est pas une signature. 

08292017, 11:08 PM
Post: #6




RE: Comparisons with zero on HP65  
08302017, 06:43 PM
(This post was last modified: 08302017 06:55 PM by Dieter.)
Post: #7




RE: Comparisons with zero on HP65
(08292017 10:32 PM)Mark Hardman Wrote: How about: Let me see if I understand this. For x > ln 2 the e^x command returns a value > 2. So DSZ decrements this to a value >1 and the next step is not skipped. For 0 < x < ln 2 the e^x command returns a value between 1 and less than 2. So DSZ decrements this to something between 0 and 0,999... and the next step is skipped. For x < 0 the e^x command returns a value between 0 and less than 1. So DSZ decrements this to something between 1 and 0. I assume that this causes the next step to be skipped. Somewhere between x=–23 and x=–24 the e^x result is so close to 0 that DSZ decrements this to a plain –1. I don't know how if the HP65 then skipped the next step or not, but I can say that the HP67 does not (!). But this way the threshold for skip/noskip is not 0, but ln 2 = 0,6931... And maybe there is a second threshold somewhere below –20 (not sure). Did I miss something here? Dieter 

08302017, 09:08 PM
Post: #8




RE: Comparisons with zero on HP65
(08302017 06:43 PM)Dieter Wrote: Let me see if I understand this. DSZ only skips 2 steps if the value in R8 is exactly zero after being decremented by 1. After posting I realized that there are underflow conditions that will result in e^x returning a value of exactly 1. Results of e^x where 1e11 <= x <= 1e10 will also return exactly 1. I concede that it is not the best solution, but it might have some value in limited cases. Mark Hardman Ceci n'est pas une signature. 

08312017, 07:49 AM
(This post was last modified: 08312017 07:55 AM by Dieter.)
Post: #9




RE: Comparisons with zero on HP65
(08302017 09:08 PM)Mark Hardman Wrote: DSZ only skips 2 steps if the value in R8 is exactly zero after being decremented by 1. OK, that's something I did not know. The HP67 skips one step if INT(RI) is zero. So your method is a X≠0? test. It turns a zero into 1 which is then decremented to zero again and DSZ skips. Or maybe it's more like a X~=0? test: (08302017 09:08 PM)Mark Hardman Wrote: After posting I realized that there are underflow conditions that will result in e^x returning a value of exactly 1. Results of e^x where 1e11 <= x <= 1e10 will also return exactly 1. So the method tests whether e^x rounds to 1 or not. Dieter 

08312017, 09:34 AM
Post: #10




RE: Comparisons with zero on HP65
The 34S's DSZ behaves the same as the 67, I didn't realise the 65 was different.
Pauli 

08312017, 11:30 AM
(This post was last modified: 08312017 12:07 PM by Dieter.)
Post: #11




RE: Comparisons with zero on HP65
(08312017 09:34 AM)Paul Dale Wrote: The 34S's DSZ behaves the same as the 67, That's fine by me. ;) This seems to be one of the improvements of the HP67 compared to its predecessor. (08312017 09:34 AM)Paul Dale Wrote: I didn't realise the 65 was different. Me neither. But good to know. Now I think I wll have to try the Panamatic HP65 emulator. Edit: The mentioned emulator should run the original microcode and thus behave like the real thing. According to my results the interval around zero where e^x is rounded to 1 is –6,1 E–11 < x < +5 E–10. Dieter 

« Next Oldest  Next Newest »

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