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
|
|||
|
|||
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 |
|||
06-02-2014, 11:04 PM
Post: #2
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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: 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
|
|||
|
|||
RE: A quick precison test
Greetings, Massimo -+×÷ ↔ left is right and right is wrong |
|||
06-03-2014, 07:23 AM
Post: #9
|
|||
|
|||
RE: A quick precison test
Gerson, thanks!
P. |
|||
06-03-2014, 09:06 AM
Post: #10
|
|||
|
|||
RE: A quick precison test
It ain't OVER 'till it's 2 PICK |
|||
06-03-2014, 09:15 AM
Post: #11
|
|||
|
|||
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" Right! ;) Greetings, Massimo -+×÷ ↔ left is right and right is wrong |
|||
06-03-2014, 11:24 AM
Post: #12
|
|||
|
|||
RE: A quick precison test | |||
06-03-2014, 11:31 AM
Post: #13
|
|||
|
|||
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! ;) 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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
RE: A quick precision test
(06-03-2014 12:25 PM)Paul Dale Wrote: This one? Greetings, Massimo -+×÷ ↔ left is right and right is wrong |
|||
06-03-2014, 01:01 PM
Post: #18
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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: 13 Guest(s)