Post Reply 
V41 and its display functions
05-08-2016, 03:56 PM
Post: #1
V41 and its display functions
For quite a while I have been using V41 ("Release 8"), and I always wondered why, unlike the "real thing", the display functions FIX, SCI and ENG prompt for a two-digit entry, i.e. FIX shows two underscores, like a STO or RCL. And indeed you can enter the same parameters as with the storage-related commands: FIX 35 or even SCI X are accepted without an error message. But what does this do?

After trying some commands like FIX 20 or SCI 99 it turned out that obviously not only the display-related settings were affected, but also the angular mode which is stored in the following flags. In case you forgot about this: On the '41, the four bits represented by flag 36...39 hold the number of digits, flag 40 is set in FIX mode, flag 41 in ENG mode (both clear means SCI), and flag 42 is set in GRAD resp. flag 43 in RAD (both clear means DEG). So it looks like this:

Code:
 Display Digits    FIX ENG GRD RAD
 F36 F37 F38 F39   F40 F41 F42 F43

For example:

Code:
 Display Digits    FIX ENG GRD RAD
 0   1   0   1      1   0   0   1
  = decimal 5

Here the calculator is set to FIX 5 and Radians mode.

Now what does a command do that is not possible on a real hardware HP41? For instance FIX 20, which can be entered on V41 without a problem. I wrote a short program that displays the status of flags 36...43, and here is what I got:

First of all, let's assume FIX 4 and DEG mode.
This yields...
Code:
 Display Digits    FIX ENG GRD RAD
 0   1   0   0      1   0   0   0
   = 4 digits
...the expected bit pattern.

What about FIX 15?
Code:
 Display Digits    FIX ENG GRD RAD
 1   1   1   1      1   0   0   0
...which means 15 digits, which of course are not displayed. But flags 36...39 now hold a bit pattern that normally would not occur on a real HP41.

Now for the interesting part. I tried a FIX 20 command:
Code:
 Display Digits    FIX ENG GRD RAD
 0   1   0   0      1   0   0   1

From the entered 20 (=10100) the four lowest bits are stored in flag 36...39, and the excessive MSB obviously has spilled into the angular mode section, so that this command turned on Radians mode!

Even more interesting: let's see what a few consecutive FIX 20 commands will do:

Code:
FIX 20 =>
 Display Digits    FIX ENG GRD RAD
 0   1   0   0      1   0   1   0

This is FIX 4 with Grad mode turned on!

Code:
FIX 20 =>
 Display Digits    FIX ENG GRD RAD
 0   1   0   0      1   0   1   1
So another FIX 20 sets both the GRAD and (!) the RAD flags. Here V41 chooses Radians mode.

One more time:

Code:
FIX 20 =>
 Display Digits    FIX ENG GRD RAD
 0   1   0   0      1   1   0   0
This time both the FIX and the ENG mode flags are set. This yields FIX 4 with an automatic switch to ENG instead of the usual SCI for small or large values.

Until here it looks like each successive FIX 20 counts up the four-bit number in F40...F43 (or at least the three bits in F41...F43).

But then, do one last FIX 20:
Code:
FIX 20 =>
 Display Digits    FIX ENG GRD RAD
 0   1   0   0      1   0   0   1

This is the same result as a few steps before.

BTW, if you tried this on V41, be sure to reset its settings to normal by a DEG and FIX 04.

So this means:
  • V41 accepts "illegal" parameters for FIX, SCI and ENG.
  • These parameters > 9 may affect not only the number of displayed digits, but also the display mode and the angular mode.
  • Successive calls of the same command may yield different results.

I have not yet figured out what's exactly happening here inside V41, but I think all this has to be considered a bug that should be corrected.

What do you think?

Dieter
Find all posts by this user
Quote this message in a reply
05-08-2016, 04:18 PM (This post was last modified: 05-08-2016 04:19 PM by Massimo Gnerucci.)
Post: #2
RE: V41 and its display functions
I can only say that V41 8E prompts for a single digit after SCI/FIX/ENG here.

What is your full release number (Help/About)?

Other modules loaded?

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
05-08-2016, 04:48 PM (This post was last modified: 05-08-2016 04:50 PM by Dieter.)
Post: #3
RE: V41 and its display functions
(05-08-2016 04:18 PM)Massimo Gnerucci Wrote:  I can only say that V41 8E prompts for a single digit after SCI/FIX/ENG here.
What is your full release number (Help/About)?

It says exactly what I posted:

Virtual HP-41
Release 8
Copyright (c) 1989-2005 Warren Furlow, and
(...a list of other contributors)

So it's version 8, without any additional letter.

(05-08-2016 04:18 PM)Massimo Gnerucci Wrote:  Other modules loaded?

Yes:
Sandmath-IV #4 Bank-Switched 4x4+
P#4 Library - Revision N2 (Experimental)

I now removed both modules. And – I can't believe it: FIX, SCI and ENG now show just one underscore and everything works as expected. Plugged both modules back, and the two-digit prompt reappears. You nailed it!

So this looks like it's not V41 that's to blame. ;-)

Ángel, what do you say? It seems to be the #4 Library. I suppose this is an outdated version. After removing only this library while leaving Sandmath plugged in, V41 turns on with "NO LIBRARY", but the FIX/SCI/ENG prompt has the usual single underscore.

Dieter
Find all posts by this user
Quote this message in a reply
05-08-2016, 06:28 PM
Post: #4
RE: V41 and its display functions
(05-08-2016 04:48 PM)Dieter Wrote:  
(05-08-2016 04:18 PM)Massimo Gnerucci Wrote:  I can only say that V41 8E prompts for a single digit after SCI/FIX/ENG here.
What is your full release number (Help/About)?

It says exactly what I posted:

Virtual HP-41
Release 8
Copyright (c) 1989-2005 Warren Furlow, and
(...a list of other contributors)

So it's version 8, without any additional letter.

Mine says:
Virtual HP-41
Release 8E
Copyright (c) 1989-2012 Warren Furlow...

I'd also update V41 to the latest release.

(05-08-2016 04:48 PM)Dieter Wrote:  
(05-08-2016 04:18 PM)Massimo Gnerucci Wrote:  Other modules loaded?

Yes:
Sandmath-IV #4 Bank-Switched 4x4+
P#4 Library - Revision N2 (Experimental)

I now removed both modules. And – I can't believe it: FIX, SCI and ENG now show just one underscore and everything works as expected. Plugged both modules back, and the two-digit prompt reappears. You nailed it!

So this looks like it's not V41 that's to blame. ;-)

Good, let's wait for an answer from Angel. :)

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
05-09-2016, 05:05 AM (This post was last modified: 05-09-2016 05:11 AM by Ángel Martin.)
Post: #5
RE: V41 and its display functions
(05-08-2016 06:28 PM)Massimo Gnerucci Wrote:  
(05-08-2016 04:48 PM)Dieter Wrote:  It says exactly what I posted:

Virtual HP-41
Release 8
Copyright (c) 1989-2005 Warren Furlow, and
(...a list of other contributors)

So it's version 8, without any additional letter.

Mine says:
Virtual HP-41
Release 8E
Copyright (c) 1989-2012 Warren Furlow...

I'd also update V41 to the latest release.

(05-08-2016 04:48 PM)Dieter Wrote:  Yes:
Sandmath-IV #4 Bank-Switched 4x4+
P#4 Library - Revision N2 (Experimental)

I now removed both modules. And – I can't believe it: FIX, SCI and ENG now show just one underscore and everything works as expected. Plugged both modules back, and the two-digit prompt reappears. You nailed it!

So this looks like it's not V41 that's to blame. ;-)

Good, let's wait for an answer from Angel. Smile


Hi Guys, sorry to say but the double digits come from the SandMath Module... as an extension to the OS prompts (it affects other functions as well, basically all single-prompts except CAT). The same functionality allows you to perform RCL math right at the RCL prompt with the arithmetic keys, as an example. This behavior is mentioned in the manual, I think (if it's not I should add a warning)


Hope that's not a problem Dieter, your post is a great explanation of the effects of such an extension - I saw this as an enhancement (as opposed to something to be blamed for) but I can understand some may not. I could make it user-selectable, say also controlled by the -RCL I/O settings.

'Cheers,
'AM
Find all posts by this user
Quote this message in a reply
05-09-2016, 07:39 AM
Post: #6
RE: V41 and its display functions
Hello, Ángel – thank you very much for your quick reply.

(05-09-2016 05:05 AM)Ángel Martin Wrote:  Hi Guys, sorry to say but the double digits come from the SandMath Module...
...
Hope that's not a problem Dieter, your post is a great explanation of the effects of such an extension - I saw this as an enhancement (as opposed to something to be blamed for) but I can understand some may not.

Well... it can cause "unexpected behaviour", as shown above. And even the same command may yield different results. With FIX, SCI, ENG and TONE parameters > 9 will not throw an error but do ..."something" instead.

There may be some use for this with TONE, at least if the generated sounds are the ones that would be obtained by a synthetic command with the same suffix (e.g. TONE 26 produces a five-second tone – which seems to be true here). But with the display commands the double digit prompt is potentially dangerous – the user has to take care that the parameter does not exceed 9.

While we're at it: Sandmath also has this "Fix Float" mode, similar to the standard display format of other calculators.
I tried Pi with different powers of 10 and this is what I got:

Code:
3,141592654
0,314159265
0,031415926
0,003141592
0,000314159
0,000031415
0,000003141
3,       -07
3,1      -08
0,000000003
3,1415926-10
3,1415926-11
3,1415926-12
...

So the display is truncated, not rounded (...31415 instead of ...31416). At a certain point the display switches to scientific notation, but with merely one or two significant digits, then back to FIX 9 and then to SCI 9. Is this the way it is supposed to work?

Dieter
Find all posts by this user
Quote this message in a reply
05-09-2016, 10:45 AM (This post was last modified: 05-09-2016 10:46 AM by Ángel Martin.)
Post: #7
RE: V41 and its display functions
(05-09-2016 07:39 AM)Dieter Wrote:  There may be some use for this with TONE, at least if the generated sounds are the ones that would be obtained by a synthetic command with the same suffix (e.g. TONE 26 produces a five-second tone – which seems to be true here). But with the display commands the double digit prompt is potentially dangerous – the user has to take care that the parameter does not exceed 9.

Yes, for "power-users" I guess there's no issue :-)

(05-09-2016 07:39 AM)Dieter Wrote:  While we're at it: Sandmath also has this "Fix Float" mode, similar to the standard display format of other calculators.
I tried Pi with different powers of 10 and this is what I got:

<see above>...

So the display is truncated, not rounded (...31415 instead of ...31416). At a certain point the display switches to scientific notation, but with merely one or two significant digits, then back to FIX 9 and then to SCI 9. Is this the way it is supposed to work?

I see what you've done, as usual pushing the envelope... (and this is a compliment). I didn't expect that "island of SCI" between before turning to the real thing, I should revise the algorithm - I don't remember how I got this done.
More to follow...

Cheers,
ÁM
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)