HP Forums
HP 40gs, error in calculator? - Printable Version

+- HP Forums (http://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: HP 40gs, error in calculator? (/thread-9416.html)



HP 40gs, error in calculator? - Skipjack - 11-01-2017 07:31 PM

Hi, finally back with HP again after 15 yrs with TI and Casio. Got My HP 40gs today which I bought on Ebay. Been testning it out, and when punching in 1/9 and then multiplying answer with 9 again it displays 0.99999999.

I thought this was a common flaw on cheaper calculators. All my other machines (some 20+ of them) will return to "1".

Any suggestions? Have I bought a fake HP?

Tnx


RE: HP 40gs, error in calculator? - brickviking - 11-01-2017 09:45 PM

(11-01-2017 07:31 PM)Skipjack Wrote:  Hi, finally back with HP again after 15 yrs with TI and Casio. Got My HP 40gs today which I bought on Ebay. Been testning it out, and when punching in 1/9 and then multiplying answer with 9 again it displays 0.99999999.

I thought this was a common flaw on cheaper calculators. All my other machines (some 20+ of them) will return to "1".

Any suggestions? Have I bought a fake HP?

Tnx

In short, no. But your other 20 calculators are merely satisfying the user when they return 1, as 1÷9 is 0.111.., multiplying 0.111..×9 will end up with 0.999.. (repeating)

Anyhow, others with much better handle on how calculators handle precision can add to this answer better than I just did. Do enjoy your 40gs, people like it because of its CAS and other graphing functions, it's a bit of a step down from the 50g.

(Post 126)


RE: HP 40gs, error in calculator? - Dieter - 11-01-2017 09:46 PM

(11-01-2017 07:31 PM)Skipjack Wrote:  Hi, finally back with HP again after 15 yrs with TI and Casio. Got My HP 40gs today which I bought on Ebay. Been testning it out, and when punching in 1/9 and then multiplying answer with 9 again it displays 0.99999999.

I thought this was a common flaw on cheaper calculators. All my other machines (some 20+ of them) will return to "1".

If other calculators return "1" they are either wrong or they are doing things behind your back.

The 12-digit value for 1/9 is 0,11111 11111 11. This is what your HP returns.
9 x 0,11111 11111 11 is 0,99999 99999 99. That's what your HP returns as well.

Imagine you manually enter 0,11111 11111 11. Now multiply this with 9. What result would you expect?

So your calculator is perfectly OK. If it would return 9 x 0,11111 11111 11 = 1 it would be simply wrong.

Some calculators use hidden digits. For instance, they use 12 digits but they only display 10. In this case the displayed rounded 10-digit value of the above calculation is 1,0000 00000. And that's what you see then. Subtract 1 from this and you should get –1E–12. If you don't your calculator applies some "result cosmetics". That's not what a decent calculator should do.

So your 40gs is perfectly OK. It calculates 1/9 correctly, and it calculates 9 x 0,11111 11111 11 correctly. Remember: 0,111... is not 1/9. It's just the first 12 digits of this. Just as any displayed result is just the first digits of the true result.

The same is true for (√2)², e^(ln 3) etc. etc. Also sin(pi) will not return zero in radians mode. Simply because the calculator does not evaluate sin(pi) but sin(3,14159265359)=–2,067...E–13.

Dieter


RE: HP 40gs, error in calculator? - toml_12953 - 11-01-2017 11:16 PM

(11-01-2017 09:46 PM)Dieter Wrote:  Also sin(pi) will not return zero in radians mode. Simply because the calculator does not evaluate sin(pi) but sin(3,14159265359)=–2,067...E–13.

Dieter

Unless you have a DM42. Then sin(pi) is -1.158028306006...E-34

Smile


RE: HP 40gs, error in calculator? - Jake Schwartz - 11-03-2017 05:40 PM

(11-01-2017 11:16 PM)toml_12953 Wrote:  Unless you have a DM42. Then sin(pi) is -1.158028306006...E-34

Smile

..and the WP-34S in "double mode" returns -1.158028306006248917735787454453501 E-34.

Jake


RE: HP 40gs, error in calculator? - Massimo Gnerucci - 11-03-2017 08:04 PM

(11-03-2017 05:40 PM)Jake Schwartz Wrote:  
(11-01-2017 11:16 PM)toml_12953 Wrote:  Unless you have a DM42. Then sin(pi) is -1.158028306006...E-34

Smile

..and the WP-34S in "double mode" returns -1.158028306006248917735787454453501 E-34.

Jake

While SHOW on the DM42 returns: -1.158028306006248941790250554076922E-34
Who's right? Or, better, closer to truth?


RE: HP 40gs, error in calculator? - pier4r - 11-03-2017 09:37 PM

interesting the difference

sin(pi)
-1.158028306006248917735787454453501 E-34 WP-34S in "double mode"
-1.158028306006248941790250554076922 E-34 DM_42 with SHOW

I would have expected way more equal digits.

Maybe Thomas, Paul, Marcus, Walter, Dieter or Gerson (and I forget many) could explain why this difference.


RE: HP 40gs, error in calculator? - toml_12953 - 11-04-2017 01:41 AM

(11-03-2017 09:37 PM)pier4r Wrote:  interesting the difference

sin(pi)
-1.158028306006248917735787454453501 E-34 WP-34S in "double mode"
-1.158028306006248941790250554076922 E-34 DM_42 with SHOW

I would have expected way more equal digits.

Maybe Thomas, Paul, Marcus, Walter, Dieter or Gerson (and I forget many) could explain why this difference.

It looks like one of them is using double precision mode to give 16-17 digits of precision. The DM-42 uses Intel's Decimal Floating-Point Math Library which conforms to the IEEE 754-2008 Decimal Floating-Point Arithmetic specification and uses quadruple-precision floating-point format (34.02 decimal digits.) What does the WP-34S use?


RE: HP 40gs, error in calculator? - Claudio L. - 11-04-2017 05:02 AM

(11-03-2017 08:04 PM)Massimo Gnerucci Wrote:  
(11-03-2017 05:40 PM)Jake Schwartz Wrote:  ..and the WP-34S in "double mode" returns -1.158028306006248917735787454453501 E-34.

Jake

While SHOW on the DM42 returns: -1.158028306006248941790250554076922E-34
Who's right? Or, better, closer to truth?

newRPL solving the mystery...

-1.158028306006248941790250554076922E-34

is the correct answer for 34 digits precision.
To obtain this answer:
34 SETPREC π0 0 + SIN
the 0 + is intentional, to round π0 to 34 digits, since it's provided with twice the current precision by default.
The actual answer for 34 SETPREC π0 SIN is:
9.862803482534211.E-80
which is only 17 digits, and the last one is not correctly rounded (should be a 2). It actually looks like an incorrect answer, but let's look deeper:
Due to internal precision multiples of 8, when 34 digits are selected it needs to work with 40 internally, then π0 provides twice that = 80 digits (hence the 10^-80 answer, those 16 first digits are the correct answer for pi with 80 digits precision).
But in reality, for the selected 34 digit precision, the digits that really matter are the ones from 10^-34 to 10^-68, which are correctly given as zero.