Re: 34s work-around for 41c quirk Message #3 Posted by Dieter on 12 Aug 2011, 6:14 p.m., in response to message #1 by gene wright
Quote:
The HP 41 SIGN command returns +1 for a value of 0.
Yes. And that makes sense. The idea behind this is the ability of the HP41 to check for alpha data:
HP-41 series:
SIGN returns
+1 for x>=0 (i.e. also for x=0)
-1 for x<0
0 if x contains alpha data
If you want a plain "mathematical" sign-function on the '41, simply use
X<>0?
SIGN
which requires just a single byte more.
So, returning 1 even for x=0 was and is okay on the HP-41 series since it has an additional benefit. But why should one duplicate this feature on another, different calculator whithout this special background that is the reason for this ..."special" behaviour? Do we really need a SIGN41 function on the 34s ?-)
BTW, as far as I see the code you proposed will not change anything, If x is zero the sign command is skipped and x remains zero (not one). If you really want to duplicate the HP-41 way, this could be done with
X=0?
INC X
SIGN
But, as already mentioned, I don't think this makes sense on the 34s.
Dieter
|