The Museum of HP Calculators

HP Forum Archive 20

[ Return to Index | Top of Index ]

wp34s Integer Word Size versus 16C
Message #1 Posted by Jake Schwartz on 5 May 2011, 3:29 p.m.

Hi,

Since in the wp34S manual (and I'm looking at the version whose page-1 display indicates version 793), it says on page two: "...completely incorporating the functionality of the famous progrmmer's calculator HP16C...", I thought I'd run the machine through its paces with the examples from the 16C manual. On page 32 of the 16C manual is a "word size" example, where when starting with a 16-bit word size in 2's-compliment mode and decimal base, the number 32767 is entered. After changing the word size to 8, the number is displayed as "-1" and then after reverting the word size back to 16, the number is shown as "255 d", since the upper half of the original 16 bits was truncated (as mentioned in the note at the bottom of the page) when the word size was halved.

So on the wp34s, I set word size to 16, 2's compliment mode and BASE10 and entered 32767 and saw "32767 d" as expected; then changed the word size to 8 and saw "-1 d" as expected. However, after changing the word size back to 16, the number reverted back to "32767 d", implying that the value in the x register had not been truncated when the word size had been halved. Since 16C compatability is expressed in the manual, shouldn't the truncation be taking place?

Thanks, Jake

      
Re: wp34s Integer Word Size versus 16C
Message #2 Posted by Walter B on 5 May 2011, 4:36 p.m.,
in response to message #1 by Jake Schwartz

Hi Jake,

Thanks for your finding. Looks like you caught me in one of the rare moments when I tried to do some simple advertising ;-) The sentence you quoted of page 2 is a very old one, set up at the time when we defined the scope of the wp34s. What functions did we want to include? Of course, the function set of the 42S was on top of our list - or you may see it as the base of the wp34s. The 16C's bit manipulation functions were something to be added. Cdfs on a non-RPL HP were only available on the 21S at that time, so I put in this model, too. And fractions came with the 32SII - so now we have the four models mentioned on page 2. And then the usual rules of organic growth took over ... and eventually you have the wp34s as it is now. Just for explanation ...

So, what to do? Obviously the 16C works as described and the wp34s deviates from this at least at the point you found. Personally, I can live with either way, I just have to know. (And it's not described yet in the manual - allowing me an escape here ;-) but anyway it's my fault.) IMHO the decisive point, however, is: Do *you want* the wp34s to handle such word size changes exactly the way the 16C does? And why? (Ok, tradition is an argument, but are there better ones?) We have the power to do it either way ...

Walter

            
Re: wp34s Integer Word Size versus 16C
Message #3 Posted by Andrés C. Rodríguez (Argentina) on 6 May 2011, 6:47 a.m.,
in response to message #2 by Walter B

Perhaps it deviates from the venerable 16C, but I feel "sign extension" is the right thing to do. At least there may be a flag controlling this choice.

Best regards, and please disregard any mistake.

      
Re: wp34s Integer Word Size versus 16C
Message #4 Posted by Paul Dale on 5 May 2011, 5:48 p.m.,
in response to message #1 by Jake Schwartz

Bummer missed this feature of the 16C :-(

What do we want to occur here?

  • The 16c changes the entire stack on a word size change.
  • The 34s does nothing to the stack but does display and operate correctly at the new size.

  • The 16c leaves registers alone but redefines their boundaries.
  • The 34s leaves registers alone and leaves their boundaries unchanged.

The latter choice isn't changing. The question is what should we do on word size change with respects to the stack.

- Pauli

            
Re: wp34s Integer Word Size versus 16C
Message #5 Posted by Jake Schwartz on 5 May 2011, 10:06 p.m.,
in response to message #4 by Paul Dale

Quote:
The question is what should we do on word size change with respects to the stack.

My vote would be to truncate the stack values when the word size is reduced....if it is relatively easy to do. Just for consistency with the 16.

Thanks, Jake

                  
Re: wp34s Integer Word Size versus 16C
Message #6 Posted by htom trites jr on 5 May 2011, 10:59 p.m.,
in response to message #5 by Jake Schwartz

Truncate the stack, if it's reasonably possible. (This emulates moving a data item to a smaller register, and then to a larger one.)

                  
Re: wp34s Integer Word Size versus 16C
Message #7 Posted by Paul Dale on 5 May 2011, 11:31 p.m.,
in response to message #5 by Jake Schwartz

Done. Will be in the next build.

There is an extra alternative I missed: truncating the value but preserving sign.

I've just done a plain truncation of the stack and last x register (but not the I register since complex operations aren't permitted in integer mode).

- Pauli

                        
Re: wp34s Integer Word Size versus 16C
Message #8 Posted by Walter B on 6 May 2011, 2:19 a.m.,
in response to message #7 by Paul Dale

Will get an extra sentence in next documentation, too.

Walter


[ Return to Index | Top of Index ]

Go back to the main exhibit hall