A quick precision test
06-02-2014, 10:37 PM (This post was last modified: 06-08-2014 01:52 PM by pito.)
Post: #1
 pito Member Posts: 127 Joined: Jun 2014
A quick precision test
A friend of mine has advised me today there is following quick precision test when testing better calculators in the shop:

Take 1.0000001 and do x^2 27times..

Windows calculator (most probably using at least 34digits decimal fp) gives me:
674530.4707410845593826891780296

Wp34s emulator shows:
674530.47054

It seems to me all the relevant digits in this test fits into 39digits standard precision the wp34s uses. Why the diff then?

UPDATE:
Basic precision:

Code:
Calculator        Display           Display-INT           Note ======================================================================= W.Alfa (Ref)      674530.470741     .4707410845           The reference ----------------------------------------------------------------------- Citizen SRP-325G  674530.4707411                          ? basic precision, web source Citizen SRP-400G  674530.4707411                          ? basic precision, web source Canon X Mk I Pro  674530.4707       .4707399243 Casio CPad300Plus 674530.4706                             web source WP-34s            674530.47054      .4705396874 WP-31s            674530.47054      .4705396874 Canon F-715SG     674530.4702       .470205499 Olympia LCD-8110  674530.4702       .470205499 Ti-80             674530.318        .3180426 TI-83 Plus Silver 674529.4131                             web source Ti-89             674529.413051     .41305068 TI-92 Plus        674529.413051                           web source Casio fx-9860     674529.1121                             web source Casio FX-6910AG   674529.1097                             web source Sharp EL-W506X    674523.3747       .3747398 SR-52             674520.6053                             web source TI-59             674520.6053                             web source HP-50g            674514.86877      .86877 HP-35s            674514.86877      .86877 HP-39GII          674514.86877                            web source HP Prime          674514.86877                            web source HP-49g            674514.86877                            web source HP-30b            674514.86877                            web source Sigma GC 500      674512.576        .576 Casio FX-602p     674494.0561                             web source HP-25             674494.05         .0561 Anitech SC100     674492.7511       .75112 Casio fx-3650P    674475.4416                             web source Casio FX-702p     674475.3961                             web source Casio fx-991MS    674472.4416       .441611 TI-57             674432.82                               web source Truly SC106A      674294.1172       .1172 Casio FX-502p     674185.8477                             web source
06-02-2014, 11:04 PM
Post: #2
 Paul Dale Senior Member Posts: 1,761 Joined: Dec 2013
RE: A quick precison test
This test is not testing precision. At least when used as you seem to have.

1.0000001 has eight digits.
1.0000001^2 has sixteen digits (x^2 once).
1.0000001^4 has thirty two digits (x^2 twice).

Doing x^2 twenty seven times is raising the original number to the power 2^27 = 134,217,728. This has 8 * 134,217,728 = 1,073,741,824 decimal digits. That is a thousand million digits there. No calculator known can deal with that many, many desktop systems would fail or at best struggle.

Since you are doing each squaring separately, there is a rounding step each time. I'm confident these roundings explain the differing results. The 34S has guaranteed correctly rounded multiplication in single precision so it is giving the precise correct answer for a sixteen digit decimal device.

- Pauli
06-03-2014, 12:07 AM
Post: #3
 pito Member Posts: 127 Joined: Jun 2014
RE: A quick precison test
Quote:Since you are doing each squaring separately, there is a rounding step each time.
Is the rounding done upon the 39th digit?
06-03-2014, 12:13 AM
Post: #4
 Paul Dale Senior Member Posts: 1,761 Joined: Dec 2013
RE: A quick precison test
16th in single precision, 34th in double.

39 digits are only used internally and are not available to the user.

- Pauli
06-03-2014, 12:27 AM (This post was last modified: 06-03-2014 12:27 AM by pito.)
Post: #5
 pito Member Posts: 127 Joined: Jun 2014
RE: A quick precison test
Now I am little bit confused. Markus wrote in the cordic topic the standard precision used is 39 digits.
Does it mean you do rounding on 16th place with "single precision" and 34th in "double" after each calculation? Why do you use the 39digit precision as the standard one then?
My naive understanding (sorry I am newbie with wp34s) is the 39digit precision is used across any calculations inside the box so it is always maintained as 39.
06-03-2014, 12:36 AM
Post: #6
 Paul Dale Senior Member Posts: 1,761 Joined: Dec 2013
RE: A quick precison test
We always round to 16 or 34 digits when we return the result to the stack. These are the only precisions a user or a keystroke program can access. Unless you are coding numerics in C, this is all you get.

The 39 digits are used inside but only during the evaluation of a built in function. Once the result is known, it is rounded. The reason is simple: guard digits. I don't need to and generally cannot get all 39 digits correct but having the extra digits gives some headroom to get the rounded result correct or at least close.

- Pauli
06-03-2014, 01:51 AM
Post: #7
 Gerson W. Barbosa Senior Member Posts: 1,473 Joined: Dec 2013
RE: A quick precison test
(06-02-2014 10:37 PM)pito Wrote:  A friend of mine has advised me today there is following quick precision test when testing better calculators in the shop:

Take 1.0000001 and do x^2 27times..

This is from an old Scientific American article, "How to handle numbers with thousands of digits, and why one might want to", by Fred Gruenberger (Computer Recreations, April 1984). ( "Come e perché trattare numeri con migliaia di cifre", in Le Scienze )

In double precision the WP 34S return:

674530,4707410845593826891847277722

Comparing this result with

674530,4707410845593826891780297468 ( 1,0000001 ENTER 27 f 2^x f y^x )

we get

Percent error = 9,92990782557e-25 ( excellent! )

As a comparison, Hewlett-Packard 33, 67, 41C returns

"674494,0561"

Percent error = 0,00540 ( not so bad in 1984 )

Regards,

Gerson.

Note: "DECIMAL-POINT IS COMMA"
06-03-2014, 06:21 AM
Post: #8
 Massimo Gnerucci Senior Member Posts: 2,491 Joined: Dec 2013
RE: A quick precison test
(06-03-2014 01:51 AM)Gerson W. Barbosa Wrote:  Note: "DECIMAL-POINT IS COMMA"

My friend! ;)

Greetings,
Massimo

-+×÷ ↔ left is right and right is wrong
06-03-2014, 07:23 AM
Post: #9
 pito Member Posts: 127 Joined: Jun 2014
RE: A quick precison test
Gerson, thanks!
P.
06-03-2014, 09:06 AM
Post: #10
 HP67 Senior Member Posts: 660 Joined: Dec 2013
RE: A quick precison test
(06-03-2014 01:51 AM)Gerson W. Barbosa Wrote:  Note: "DECIMAL-POINT IS COMMA"

COBOL!

It ain't OVER 'till it's 2 PICK
06-03-2014, 09:15 AM
Post: #11
 Massimo Gnerucci Senior Member Posts: 2,491 Joined: Dec 2013
RE: A quick precison test
(06-03-2014 09:06 AM)HP67 Wrote:
(06-03-2014 01:51 AM)Gerson W. Barbosa Wrote:  Note: "DECIMAL-POINT IS COMMA"

COBOL!

Right! ;)

Greetings,
Massimo

-+×÷ ↔ left is right and right is wrong
06-03-2014, 11:24 AM
Post: #12
 walter b On Vacation Posts: 1,957 Joined: Dec 2013
RE: A quick precison test
(06-03-2014 06:21 AM)Massimo Gnerucci Wrote:
(06-03-2014 01:51 AM)Gerson W. Barbosa Wrote:  Note: "DECIMAL-POINT IS COMMA"

My friend!

Quite natural, isn't it?

d:-)
06-03-2014, 11:31 AM
Post: #13
 Massimo Gnerucci Senior Member Posts: 2,491 Joined: Dec 2013
RE: A quick precison test
(06-03-2014 11:24 AM)walter b Wrote:
(06-03-2014 06:21 AM)Massimo Gnerucci Wrote:  My friend! ;)

Quite natural, isn't it? ;)

d:-)

To us, yes.
Cobol sentence mandatory in every program I wrote... :)

Greetings,
Massimo

-+×÷ ↔ left is right and right is wrong
06-03-2014, 11:50 AM
Post: #14
 HP67 Senior Member Posts: 660 Joined: Dec 2013
RE: A quick precison test
Hah! I never used it, and I never saw a piece of code that used it. I just remember it from the manuals.

It ain't OVER 'till it's 2 PICK
06-03-2014, 12:25 PM
Post: #15
 Paul Dale Senior Member Posts: 1,761 Joined: Dec 2013
RE: A quick precison test
Code:
ALTER THERE TO PROCEED TO ELSEWHERE.

Pure brilliance.

Almost as good as the RAMBOTRAN:
Code:
COME FROM

Does anyone here have a scan of the RAMBOTRAN document? I read it a couple of decades or more ago and haven't been able to locate it again.

- Pauli
06-03-2014, 12:41 PM
Post: #16
 HP67 Senior Member Posts: 660 Joined: Dec 2013
RE: A quick precison test
I thought that was from Intercal COME FROM

Have never heard of RAMBOTRAN.

You can do some hilarious stuff in PL/I since it has no reserved words. I can't find the example I used to like but here is something similar:

Code:
if then then then=else; else else=then;

And this
Code:
IF IF THEN THEN = ELSE ;

It ain't OVER 'till it's 2 PICK
06-03-2014, 12:57 PM
Post: #17
 Massimo Gnerucci Senior Member Posts: 2,491 Joined: Dec 2013
RE: A quick precision test
(06-03-2014 12:25 PM)Paul Dale Wrote:
Code:
ALTER THERE TO PROCEED TO ELSEWHERE.

Pure brilliance.

Almost as good as the RAMBOTRAN:
Code:
COME FROM

Does anyone here have a scan of the RAMBOTRAN document? I read it a couple of decades or more ago and haven't been able to locate it again.

- Pauli

This one?

Greetings,
Massimo

-+×÷ ↔ left is right and right is wrong
06-03-2014, 01:01 PM
Post: #18
 HP67 Senior Member Posts: 660 Joined: Dec 2013
RE: A quick precision test
That was posted 13 years after INTERCAL implemented the COME FROM statement.

And honestly, I don't see from that post that RAMBOTRAN is that much different from RPG

It ain't OVER 'till it's 2 PICK
06-03-2014, 01:52 PM
Post: #19
 walter b On Vacation Posts: 1,957 Joined: Dec 2013
RE: A quick precision test
Great text - you made my day!

d:-)
06-03-2014, 01:56 PM (This post was last modified: 06-03-2014 01:56 PM by walter b.)
Post: #20
 walter b On Vacation Posts: 1,957 Joined: Dec 2013
RE: A quick precision test
That COME FROM statement is what's obviously missing on this very forum in Linear Mode.

d:-)
 « Next Oldest | Next Newest »

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