Posts: 349
Threads: 66
Joined: Apr 2007
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
Posts: 4,587
Threads: 105
Joined: Jul 2005
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
Posts: 3,229
Threads: 42
Joined: Jul 2006
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
Posts: 349
Threads: 66
Joined: Apr 2007
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
Posts: 66
Threads: 2
Joined: Aug 2007
Truncate the stack, if it's reasonably possible. (This emulates moving a data item to a smaller register, and then to a larger one.)
Posts: 3,229
Threads: 42
Joined: Jul 2006
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
Posts: 4,587
Threads: 105
Joined: Jul 2005
Will get an extra sentence in next documentation, too.
Walter
Posts: 1,193
Threads: 43
Joined: Jul 2005
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.