HP Forums
[34S & 31S] Unique display mode: significant figures - Printable Version

+- HP Forums (http://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not quite HP Calculators - but related (/forum-8.html)
+--- Thread: [34S & 31S] Unique display mode: significant figures (/thread-3029.html)

Pages: 1 2


[34S & 31S] Unique display mode: significant figures - Bit - 02-07-2015 09:01 PM

The WP 34S and 31S have for a long time had a compile time option to add the rarely seen 'significant figures' display mode, implemented by Nigel. Very few calculators offer this feature, one example is the Commodore S61 from 1976. Nigel and I have recently been working on some improvements, have fixed a few minor issues and introduced an intuitive user interface. Two new modes are available: SIG and its zero-padded variant, SIG0. Both modes accept arguments from 0 to 7, allowing up to 8 of the most significant digits to be displayed.

In the 31S, these display modes can simply be selected from the DISP menu. In the 34S, [h] [FIX] opens a catalog where you can navigate using the arrow keys or simply by pressing [B] again to select the new modes (there's no need to press ENTER before entering the mode argument) as illustrated below.

[Image: attachment.php?aid=1585]

Significant figures modes format numbers to a number of significant digits equal to one more than the mode argument. Unlike SCI or ENG mode, exponent notation is not used unless the number is outside the range 10-4 to 109. Trailing zeros are removed in SIG mode and displayed in SIG0 mode. Entering pi and successively multiplying or dividing it by 10 will display the following in SIG 4 mode:

           3.1416        3.1416
          31.416         0.31416
         314.16          0.031416
       3 141.6           0.0031416
      31 416             0.00031416
     314 160             3.1416 e -5
   3 141 600             3.1416 e -6
  31 416 000
 314 160 000
           3.1416 e 9
           3.1416 e 10


This feature has been integrated into mainline but it isn't enabled in the official builds. If you'd like to try it, either get the sources, uncomment INCLUDE_SIGFIG_MODE in features.h and recompile the calculator, or download my precompiled binaries.


RE: [34S & 31S] Unique display mode: significant figures - walter b - 02-07-2015 09:49 PM

Please elaborate this example for SIG0.

d:-)


RE: [34S & 31S] Unique display mode: significant figures - Bit - 02-07-2015 10:07 PM

(02-07-2015 09:49 PM)walter b Wrote:  Please elaborate this example for SIG0.

Here's what happens if you enter 123 and multiple or divide it by 10 repeatedly in SIG0 4 mode:

         123.00         123.00
       1 230.0           12.300
      12 300              1.2300
     123 000              0.12300
   1 230 000              0.012300
  12 300 000              0.0012300
 123 000 000              0.00012300
           1.2300 e 9     1.2300 e -5
           1.2300 e 10    1.2300 e -6



RE: [34S & 31S] Unique display mode: significant figures - Nigel (UK) - 02-07-2015 10:13 PM

(02-07-2015 09:01 PM)Bit Wrote:  The WP 34S and 31S have for a long time had a compile time option to add the rarely seen 'significant figures' display mode, implemented by Nigel. Very few calculators offer this feature, one example is the Commodore S61 from 1976. Nigel and I have recently been working on some improvements, have fixed a few minor issues and introduced an intuitive user interface. Two new modes are available: SIG and its zero-padded variant, SIG0. Both modes accept arguments from 0 to 7, allowing up to 8 of the most significant digits to be displayed.

In the 31S, these display modes can simply be selected from the DISP menu. In the 34S, [h] [FIX] opens a catalog where you can navigate using the arrow keys or simply by pressing [B] again to select the new modes (there's no need to press ENTER before entering the mode argument) as illustrated below.

[Image: attachment.php?aid=1585]

Significant figures modes format numbers to a number of significant digits equal to one more than the mode argument. Unlike SCI or ENG mode, exponent notation is not used unless the number is outside the range 10-4 to 109. Trailing zeros are removed in SIG mode and displayed in SIG0 mode. Entering pi and successively multiplying or dividing it by 10 will display the following in SIG 4 mode:

           3.1416        3.1416
          31.416         0.31416
         314.16          0.031416
       3 141.6           0.0031416
      31 416             0.00031416
     314 160             3.1416 e -5
   3 141 600             3.1416 e -6
  31 416 000
 314 160 000
           3.1416 e 9
           3.1416 e 10


This feature has been integrated into mainline but it isn't enabled in the official builds. If you'd like to try it, either get the sources, uncomment INCLUDE_SIGFIG_MODE in features.h and recompile the calculator, or download my precompiled binaries.

Many thanks to Bit for the work done on bringing the significant figures mode for the WP 34S and 31S up to date. Since (as Bit points out) it hasn't been included on very many calculators in the last forty years, I thought I'd just explain why I took the trouble to write it and why I like it so much.

First question: why limit significant figures at all on a calculator that can handle numbers with up to 37 or so digits? The answer is simple: I am a physics teacher, and when my students and I do experiments the quantities we measure are rarely known to more than 3 significant figures. I like being able to limit the digits displayed to a realistic number and that number is always much less than 12, let alone 37!

Second question: what's wrong with SCI or ENG mode? These modes do limit significant figures, but they also impose trailing zeroes and standard form. I do not like entering "2" and seeing it displayed as "2.00E00". This is partly because I like my calculator to do my work for me, but it's also nice to show my students calculated resistances, angles of refraction, volumes, pressures, densities (etc.) on the screen of my WP-34S to exactly 3 significant figures. My younger students (and some older ones too) who don't "get" powers of ten can then see what 3 s.f. means and that I practise what I preach (although, as yet, none have been persuaded to get a WP-34S for themselves!).

If you want to avoid standard form but still need trailing zeroes then SIG0 mode lets you do this. "2" is displayed as "2.00" in SIG0_2 mode.

This goes beyond teaching. Except when doing accounts or integer arithmetic, when can you really justify using more than 3 or 4 s.f.? Most of the digits in an answer are just noise. My calculator is nearly always set to SIG_2 or SIG_3 mode; everything looks so much neater and (nearly) every displayed digit means something. If you download a firmware versions that includes this feature, give it a try! You may find that you like it. Or not. But it's there if you ever want it.

Nigel (UK)


RE: [34S & 31S] Unique display mode: significant figures - walter b - 02-07-2015 10:13 PM

(02-07-2015 10:07 PM)Bit Wrote:  
(02-07-2015 09:49 PM)walter b Wrote:  Please elaborate this example for SIG0.

Here's what happens if you enter 123 and multiple or divide it by 10 repeatedly in SIG0 4 mode: ...

Obviously, I should have written "SIG 0" instead.

d:-)


RE: [34S & 31S] Unique display mode: significant figures - Bit - 02-07-2015 10:22 PM

(02-07-2015 10:13 PM)walter b Wrote:  
(02-07-2015 10:07 PM)Bit Wrote:  Here's what happens if you enter 123 and multiple or divide it by 10 repeatedly in SIG0 4 mode: ...

Obviously, I should have written "SIG 0" instead.

SIG 0 mode displays the single most significant digit only, this is what you get with pi:

           3       3
          30       0.3
         300       0.03
       3 000       0.003
      30 000       0.0003
     300 000       3 e -5
   3 000 000       3 e -6
  30 000 000
 300 000 000
           3 e 9
           3 e 10



RE: [34S & 31S] Unique display mode: significant figures - BarryMead - 02-08-2015 03:06 AM

(02-07-2015 09:01 PM)Bit Wrote:  The WP 34S and 31S have for a long time had a compile time option to add the rarely seen 'significant figures' display mode, implemented by Nigel.
This is very interesting. There are a number of scientific disciplines (especially chemistry) that consider it an ERROR to include more significant digits in your answer than were presented in the numbers of the original problem. Using these calculator modes to CLAMP OFF the significant digits to a right size would help prevent researchers/students in these disciplines from accidentally supplying an erroneously OVER-ACCURATE answer.


RE: [34S & 31S] Unique display mode: significant figures - walter b - 02-08-2015 12:08 PM

(02-08-2015 03:06 AM)BarryMead Wrote:  There are a number of scientific disciplines (especially chemistry) that consider it an ERROR to include more significant digits in your answer than were presented in the numbers of the original problem. Using these calculator modes to CLAMP OFF the significant digits to a right size would help prevent researchers/students in these disciplines from accidentally supplying an erroneously OVER-ACCURATE answer.

IIRC, that's something also taught in physics in 2nd year at university in the basic lab course, mentioning Mr. C. F. Gauß who found the rules of error propagation (among other important stuff). Please cf. pp. 226 and 348 of the spiral bound manual. If, however, all papers could scream where over-accurate results were printed between 1972 and today, you'll never visit the sci/tech section of a library anymore. Confused Seems many people forget those rules pretty soon.

d:-)


RE: [34S & 31S] Unique display mode: significant figures - matthiaspaul - 02-08-2015 07:49 PM

I think, this is a useful feature and should be included in the standard configuration.

In fact, it touches one of the items on my (preliminary and still unpublished) list of possible improvements at least in regard to the (optional) suppression of trailing zeros. I was thinking about proposing TZON / TZOFF commands in DECM mode to either enable trailing zeros (as now) or to suppress more than the necessary amount of trailing zeros and right justify the mantisse. Since a new flag for this seemed to be overkill, I thought, it could be combined with flag 33, which is used for LZON / LZOFF already, and just rename these commands RZON / RZOFF ("redundant zeros on/off").

But then I found that on the WP 34S I could achieve what I was missing (on the 48GX and 50g) by combining ALL 0 with ENGOVR. (On the 48GX and 50g I can use STD, but it will default to SCI mode rather than ENG mode for numbers too large or small to fit.) Redundant trailing zeros may still be displayed in FIX mode, but I guess this is what most people want...

Greetings,

Matthias


RE: [34S & 31S] Unique display mode: significant figures - matthiaspaul - 02-08-2015 08:09 PM

(02-07-2015 09:01 PM)Bit Wrote:  The WP 34S and 31S have for a long time had a compile time option to add the rarely seen 'significant figures' display mode, implemented by Nigel. Very few calculators offer this feature, one example is the Commodore S61 from 1976.
I am quite sure I have seen this feature on an old nixie-tube Privileg calculator (with horribly bouncing keyboard, but otherwise nice) as well. It must have been from around the same time frame.
Quote:Two new modes are available: SIG and its zero-padded variant, SIG0. Both modes accept arguments from 0 to 7, allowing up to 8 of the most significant digits to be displayed.
Not knowing how the state information for these modes was squeezed into the existing flags record, if it helps to save a bit, the SIG/SIG0 mode could also take the setting of the "LZON/LZOFF" flag 33 into account, I guess.

Greetings,

Matthias


RE: [34S & 31S] Unique display mode: significant figures - Bit - 02-08-2015 08:54 PM

(02-08-2015 08:09 PM)matthiaspaul Wrote:  
Quote:Two new modes are available: SIG and its zero-padded variant, SIG0. Both modes accept arguments from 0 to 7, allowing up to 8 of the most significant digits to be displayed.
Not knowing how the state information for these modes was squeezed into the existing flags record, if it helps to save a bit, the SIG/SIG0 mode could also take the setting of the "LZON/LZOFF" flag 33 into account, I guess.
Four bits store the mode argument but only the values 0-11 are used for the four other modes. It was Nigel's idea to use values 12-15 for the new SIG and SIG0 modes. It only allows 8 settings for each new mode but in this case that's sufficient. Look at [gs]et_dispmode_digs() in xeq.c to see how it's implemented, for which I'll take the blame.

LZON/LZOFF controls leading zeros in integer modes, which is a very different issue in my opinion, I'm not sure I'd want to mix those two things.


RE: [34S & 31S] Unique display mode: significant figures - Bit - 02-08-2015 09:01 PM

(02-08-2015 07:49 PM)matthiaspaul Wrote:  In fact, it touches one of the items on my (preliminary and still unpublished) list of possible improvements at least in regard to the (optional) suppression of trailing zeros. I was thinking about proposing TZON / TZOFF commands in DECM mode to either enable trailing zeros (as now) or to suppress more than the necessary amount of trailing zeros and right justify the mantisse. Since a new flag for this seemed to be overkill, I thought, it could be combined with flag 33, which is used for LZON / LZOFF already, and just rename these commands RZON / RZOFF ("redundant zeros on/off").

Ideally, the minimum and maximum number of total digits, digits before the radix mark, digits after the radix mark, how zero padding is used, the high and low cutoff points for switching to exponent notation etc. should all be individually configurable, and then a few presets that correspond to ALL, SCI etc. modes should be provided to make commonly used settings fast to access. The only reason not to implement this level of flexibility is the limited space in the flash and RAM.


RE: [34S & 31S] Unique display mode: significant figures - Paul Dale - 02-08-2015 11:55 PM

(02-08-2015 09:01 PM)Bit Wrote:  The only reason not to implement this level of flexibility is the limited space in the flash and RAM.

Backwards compatibility with HP's old displays schemes is another good reason. It might possibly have been easier to provide individual control over all these settings and ditch the FIX, SCI, ENG commands.

I didn't much enjoy coding the display modes when I first wrote them. I'm wouldn't be surprised if some of the quirks were more accidents in the original HP implementation.


Pauli


RE: [34S & 31S] Unique display mode: significant figures - matthiaspaul - 02-09-2015 12:58 AM

Thinking about it, I find the choice of the SIG0 name sub-optimal. It's intuitive, but it can easily lead to confusion given that SIG and SIG0 exist and both can have 0 as an argument as well. What about using SIGZ or SIGTZ instead?

Greetings,

Matthias


RE: [34S & 31S] Unique display mode: significant figures - Bit - 02-09-2015 02:20 AM

(02-08-2015 11:55 PM)Paul Dale Wrote:  
(02-08-2015 09:01 PM)Bit Wrote:  The only reason not to implement this level of flexibility is the limited space in the flash and RAM.

Backwards compatibility with HP's old displays schemes is another good reason.

With a flexible enough configuration scheme, mimicking HP's displays would simply be a matter of providing the right presets.


RE: [34S & 31S] Unique display mode: significant figures - Bit - 02-09-2015 02:34 AM

(02-09-2015 12:58 AM)matthiaspaul Wrote:  Thinking about it, I find the choice of the SIG0 name sub-optimal. It's intuitive, but it can easily lead to confusion given that SIG and SIG0 exist and both can have 0 as an argument as well. What about using SIGZ or SIGTZ instead?

SIGTZ is too long, considering that there's already a double arrow on the left and an indirection arrow can appear on the right along with a dot for local registers and a register number on top of all that.

SIG0 can indeed be confusing not when using the calculator but if you're discussing it and fail to make the distinction between the specific mode "SIG 0" (SIG with the mode argument zero) and the set of "SIG0" modes (SIG0 mode with an unspecified argument). I'm not sure this justifies using e.g. SIGZ instead of the IMO more expressive SIG0 name but it is a valid concern.


RE: [34S & 31S] Unique display mode: significant figures - matthiaspaul - 02-09-2015 03:15 AM

(02-08-2015 08:54 PM)Bit Wrote:  Four bits store the mode argument but only the values 0-11 are used for the four other modes. It was Nigel's idea to use values 12-15 for the new SIG and SIG0 modes. It only allows 8 settings for each new mode but in this case that's sufficient. Look at [gs]et_dispmode_digs() in xeq.c to see how it's implemented
Thanks for the pointer, I just had a look. That's a nice solution to squeeze the information in there Wink although quite "wasteful" code-wise (noone's fault)...

Since I was thinking about how to squeeze some additional state info into two other groups of flags and came to a similar (although not identical) potential solution last week, I am wondering if there is a hard limit to not extend UState beyond 64 bits (f.e. because we're running out of RAM), or is this just to maintain backward compatibility for now? As it looks now, adding another couple of bits to UState could save quite a bit of code elsewhere.
Quote:LZON/LZOFF controls leading zeros in integer modes, which is a very different issue in my opinion, I'm not sure I'd want to mix those two things.
Yes, I agree. I was suggesting this just in case we'd be really running out of status bits.

Greetings,

Matthias


RE: [34S & 31S] Unique display mode: significant figures - mendesp - 02-11-2015 06:15 PM

I'm probably missing something here, but I can't figure out why I should set SIG 4 to get a 5 significant figures, like in 3.1415, instead of defining a SIG 5 format. It seems to me much easier to ask for a given number of sig figs using SIG display mode. Any explanation would be appreciated.

Regards,

Patrick


RE: [34S & 31S] Unique display mode: significant figures - Nigel (UK) - 02-11-2015 08:18 PM

(02-11-2015 06:15 PM)mendesp Wrote:  I'm probably missing something here, but I can't figure out why I should set SIG 4 to get a 5 significant figures, like in 3.1415, instead of defining a SIG 5 format. It seems to me much easier to ask for a given number of sig figs using SIG display mode. Any explanation would be appreciated.

Regards,

Patrick

Two reasons:
  • Analogy with SCI mode - for example, SCI 3 gives 4 significant figures
  • So that SIG 0 displays something useful!
I fully accept that neither reason is entirely convincing, but it's what I chose to do when I wrote the original version of the code and Bit hasn't changed the way it works.

Nigel (UK)


RE: [34S & 31S] Unique display mode: significant figures - mendesp - 02-12-2015 02:50 AM

Thank you Nigel for your answer. I understand your reasons. With all respect to your code and Bit's work, do you think I could "easily" modify it so the SIG display could be used like I wish ?

Could you then point me the code lines I would have to modify ?

Regards,

Patrick