wp34s Integer Word Size versus 16C
#1

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

#2

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

#3

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

#4

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

#5

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

#6

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

#7

Will get an extra sentence in next documentation, too.

Walter

#8

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.



Possibly Related Threads…
Thread Author Replies Views Last Post
  Bought a 16C to compensate a little Eelco Rouw 23 8,196 12-07-2013, 01:26 PM
Last Post: Eelco Rouw
  Prime: Program size limited to 64K? Erwin Ried 4 2,083 11-17-2013, 11:42 PM
Last Post: Joseph Ec
  Prime: size display bug when editing large programs BruceH 2 1,387 10-31-2013, 05:30 PM
Last Post: BruceH
  Shiny new 16C! Keith Midson 7 2,667 10-27-2013, 02:22 AM
Last Post: Keith Midson
  HP Prime: Edit integer in RPN mode plivesey 15 5,076 10-18-2013, 04:34 PM
Last Post: kris223
  HP Prime SIZE and OBJ-> with matrices/vectors/lists Helge Gabert 8 2,938 09-27-2013, 05:44 PM
Last Post: Helge Gabert
  Prime Edit Integer kris223 8 2,699 09-24-2013, 06:43 PM
Last Post: kris223
  HP-Prime_CAS versus MAPLE_CAS CompSystems 0 889 08-18-2013, 11:58 PM
Last Post: CompSystems
  HP-16C simulator fhub 12 3,609 06-30-2013, 10:14 PM
Last Post: Robert Prosperi
  OT: How to get data from WinXP to a full-size PCMCIA SRAM card Gene Wright 10 3,267 06-25-2013, 08:03 PM
Last Post: gene wright

Forum Jump: