34s work-around for 41c quirk « Next Oldest | Next Newest »

 ▼ Gene Wright Posting Freak Posts: 1,545 Threads: 168 Joined: Jul 2005 08-12-2011, 05:53 PM The HP 41 SIGN command returns +1 for a value of 0. The 34s returns 0 for a value of 0. So, what's an efficient way to code around this difference? Could be: ```X=0? SKIP 01 SIGN``` What do you think? ▼ Dieter Senior Member Posts: 653 Threads: 26 Joined: Aug 2010 08-12-2011, 06:14 PM 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 ▼ M. Joury Posting Freak Posts: 756 Threads: 31 Joined: Aug 2010 08-12-2011, 06:26 PM My initial thought was that it should work. But you are right, it doesn't. Your solution does however. I guess if you were converting an HP-41 program this might be useful. Paul Dale Posting Freak Posts: 3,229 Threads: 42 Joined: Jul 2006 08-12-2011, 06:36 PM Dieter is correct and suggested the same workaround I thought of when I saw the question :-) The only difference with the workaround is Last X is set incorrectly when X is zero. We've a total inability to distinguish alpha data from numbers unlike the 41 series. I think I could work around this with reals either by reducing the number of digits by one or reserving lots of NaN values as alpha data. This is pointless since we also support integers for which there is no space available to distinguish. This is something that will definitely be addressed in the 34S successor. I'd still differ from the 41 series though. SIGN would still return -1, 0, +1 for negative, zero and positive numbers. We've got NaN for the string case :-) - Pauli ▼ Gene Wright Posting Freak Posts: 1,545 Threads: 168 Joined: Jul 2005 08-12-2011, 06:40 PM I am converting some HP 41 programs that store a -1 or 1 depending on the value in X. Don't think LastX will be a problem, so I think Dieter's approach will work. I am not advocating for a SIGN41 function. :-) and I like the SIGN function on the 34s, just wanting to make sure I had not overlooked something... Edited: 12 Aug 2011, 6:51 p.m. ▼ Paul Dale Posting Freak Posts: 3,229 Threads: 42 Joined: Jul 2006 08-12-2011, 07:07 PM Quote:I am not advocating for a SIGN41 function. :-) and I like the SIGN function on the 34s, just wanting to make sure I had not overlooked something... Don't worry there is no chance of a SIGN41 function :-) There is a better solution that does Last X correctly too: ``` SIGN X=0? INC X ``` Put this into a S41 subroutine if you are keen. - Pauli fhub Posting Freak Posts: 1,216 Threads: 75 Joined: Jun 2011 08-12-2011, 06:14 PM Quote: The HP 41 SIGN command returns +1 for a value of 0. The 34s returns 0 for a value of 0. So, what's an efficient way to code around this difference? Could be: ```X=0? SKIP 01 SIGN``` What do you think? No, that won't work: it gives 0 if x=0 (because it just skips the SIGN in this case). If you replace SKIP 01 by 10^x (or e^x) it would work as you want! Franz PS: Dieter's solution INC X is indeed better (because faster) than my 10^x - I'm just not used to this INC X because none of my other calculators has it. Edited: 12 Aug 2011, 6:31 p.m.

 Possibly Related Threads... Thread Author Replies Views Last Post emu48 - copy stack doesn't work (as expected) Thomas Radtke 2 1,181 11-11-2013, 02:19 PM Last Post: Thomas Radtke Another Prime mystery - templates don't work anymore Michael de Estrada 2 822 11-02-2013, 11:34 AM Last Post: Michael de Estrada Does the HP Prime software only work with Win 7/ 8 ? Michael de Estrada 3 1,013 10-12-2013, 02:52 PM Last Post: John Ioannidis Back to School/Work/Other Calculator Poll Eddie W. Shore 63 9,522 09-12-2013, 06:03 AM Last Post: bhtooefr How I use my HP50G at work. David Bengtson 7 1,440 05-06-2013, 02:57 PM Last Post: Ingo Does IR printing not work on your converted WP34s? Then read on... Harald 3 986 04-04-2013, 05:46 PM Last Post: Harald No luck getting flash disk to work in 95lx Harald 7 1,893 03-18-2013, 08:11 AM Last Post: Harald 35s refuses to work Silvio A. Bensi 19 3,770 10-18-2012, 12:48 AM Last Post: Reth HP-33S Display Quirk Matt Agajanian 4 993 05-15-2012, 08:31 AM Last Post: Michael de Estrada How does the HP-97 printer paper feed work? Harald 5 1,350 03-31-2012, 09:31 AM Last Post: Harald

Forum Jump: