Post Reply 
Approximate pi to 24 digits via keyboard
02-02-2015, 02:43 AM
Post: #21
RE: Approximate pi to 24 digits via keyboard
(02-01-2015 10:25 PM)Dieter Wrote:  
(02-01-2015 09:17 PM)Rick314 Wrote:  (I checked with extended-precision software and Dieter's 3 answers are indeed the best 12-digit answers possible. They are also what my HP-35S returns, so kudos to the HP-35S same as for its sin(x) algorithm.) I don't think there is any "relative error" on the 3 different inputs, and the 3 different answers are the correct 12-digit answers.

Yes, the 35s does return these three results – actually that's the calculator I used for the calculation. But you should not be too generous with your kudos: take a look at these results by the 35s and probably also other HPs:

Code:
3,1           [SIN]  4,15806624333 E-2    exact
3,14          [SIN]  1,59265291648 E-3    last digit off (-1 ULP)
3,141         [SIN]  5,92653555096 E-4    last digit off (-3 ULP)
3,1415        [SIN]  9,26535896582 E-5    last 2 digits off (-25 ULP)
3,14159       [SIN]  2,65358979 E-6       last 3 digits lost
3,141592      [SIN]  6,5358979 E-7        last 4 digits lost
3,1415926     [SIN]  5,358979 E-8         last 5 digits lost
3,14159265    [SIN]  3,58979 E-9          last 6 digits lost
3,141592653   [SIN]  5,89793238463 E-10   exact
3,1415926535  [SIN]  8,97932384626 E-11   exact
3,14159265358 [SIN]  9,79323846264 E-12   exact

;-)

Dieter

Not all other 12-digit HP calculators, only the HP-33s from which the HP-35s inherited this and many other bugs.

These are the HP-42S results:

Code:

3,1           [SIN]  4,15806624333 E-2    exact
3,14          [SIN]  1,59265291649 E-3    exact
3,141         [SIN]  5,92653555099 E-4    exact
3,1415        [SIN]  9,26535896607 E-5    exact
3,14159       [SIN]  2,65358979324 E-6    exact
3,141592      [SIN]  6,53589793238 E-7    exact
3,1415926     [SIN]  5,35897932385 E-8    exact
3,14159265    [SIN]  3,58979323846 E-9    exact
3,141592653   [SIN]  5,89793238463 E-10   exact
3,1415926535  [SIN]  8,97932384626 E-11   exact
3,14159265358 [SIN]  9,79323846264 E-12   exact

Gerson.
Find all posts by this user
Quote this message in a reply
02-02-2015, 02:57 AM (This post was last modified: 02-02-2015 03:00 AM by Gerson W. Barbosa.)
Post: #22
RE: Approximate pi to 24 digits via keyboard
(01-31-2015 07:11 AM)Dieter Wrote:  
(01-30-2015 08:38 PM)Gilles Wrote:  It works with the 48SX - 49 -50.
Don't work with the 15C LE

Right, the 15C should return three additional digits, as mentioned in my other post. Since the third digit is zero, you'll see only two (5,9 E–10). ;-)

Yes, I get extra digits on my HP-15C and even on my HP 12c Platinum :-) (*)

HP-15C:

3.1415 92653589(87)

Keystrokes:

g RAD
3.1415 SIN f CLEAR PREFIX


HP 12c Platinum:

3.1415 926535(9574)

Keystrokes:

g GTO 273 R/S
3.1415 R/S f CLEAR PREFIX


Gerson.

(*) Mine is actually a 12c Prestige
Find all posts by this user
Quote this message in a reply
02-02-2015, 06:56 AM
Post: #23
RE: Approximate pi to 24 digits via keyboard
(02-02-2015 02:57 AM)Gerson W. Barbosa Wrote:  Yes, I get extra digits on my HP-15C and even on my HP 12c Platinum :-) (*)

Extra digits don't mean extra accuracy. ;-)

The 15C (and probably also the 41C) essentially show the same behaviour as the 35s. First the result becomes slightly inaccurate, then the final digits are lost:

(02-02-2015 02:57 AM)Gerson W. Barbosa Wrote:  HP-15C:
3.1415 92653589(87)

...while it should be

3.1415 9265358966

So the last two digits are off. As we move closer to pi the result loses digits: for instance sin 3,14159 is returned as 2,65359 E–6. The best we can squeeze out of the 15C is 3,141592653590 – that's pi rounded to 13 digits.

So no miracles on this side either. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
02-02-2015, 06:46 PM (This post was last modified: 02-02-2015 06:50 PM by Rick314.)
Post: #24
RE: Approximate pi to 24 digits via keyboard
(02-01-2015 10:25 PM)Dieter Wrote:  But you should not be too generous with your kudos: take a look at these results by the 35s and probably also other HPs...

Thank you Dieter. I found your table very interesting and quite a disappointment. It should be added to the HP-35S Bug List. I think what you showed are definitely defects, and worse than most others in the Bug List. The calculator isn't calculating right. For comparison, I checked my old HP-32SII against the UNIX/Cygwin "bc" extended-precision program (mantissas only displayed for it):
Code:

x              32SII sin(x)         bc -l rounded
=============  ==================  ==============
3.1            4.15806624333 e-2    4.15806624333
3.14           1.59265291649 e-3    1.59265291649
3.141          5.92653555099 e-4    5.92653555099
3.1415         9.26535896607 e-5    9.26535896607
3.14159        2.65358979324 e-6    2.65358979324
3.141592       6.53589793238 e-7    6.53589793238
3.1415926      5.35897932385 e-8    5.35897932385
3.14159265     3.58979323846 e-9    3.58979323846
3.141592653    5.89793238463 e-10   5.89793238463
3.1415926535   8.97932384626 e-11   8.97932384626
3.14159265358  9.79323846264 e-12   9.79323846264
All HP-32SII results are correct to 12 digits, at least in this situation. One might expect that newer calculators from the same company (whether outsourced or not) are at least as good as older ones at common functions like sin(x). But not so. (:-(

Update: I had this post composed before seeing the 42S results posted by Gerson W. Barbosa. As expected the 42S and 32SII agree.
Find all posts by this user
Quote this message in a reply
02-02-2015, 11:01 PM
Post: #25
RE: Approximate pi to 24 digits via keyboard
(02-01-2015 11:34 AM)J-F Garnier Wrote:  
(02-01-2015 11:07 AM)Thomas Klemm Wrote:  Could you provide a link where we could access them?

The HP-71B IDS documents are available on the MoHPC DVD (or USB drive now).

Wait... the entire HP 71B ROM source code is available? Did I understand this correctly?

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
02-03-2015, 12:01 AM
Post: #26
RE: Approximate pi to 24 digits via keyboard
(02-02-2015 11:01 PM)Han Wrote:  Wait... the entire HP 71B ROM source code is available? Did I understand this correctly?

Yes. But it is nowhere near as hilarious as the HP-75C NOMAS source code listing:

* "Hey Roo-man! Why do Vulcans have pointed ears?"

* "I don't know, Joey. Why DO Vulcans have pointed ears?"

* "So they can count to twelve!!!"

Ceci n'est pas une signature.
Find all posts by this user
Quote this message in a reply
02-03-2015, 12:33 AM
Post: #27
RE: Approximate pi to 24 digits via keyboard
(02-02-2015 11:01 PM)Han Wrote:  Wait... the entire HP 71B ROM source code is available? Did I understand this correctly?

The HP-71B is by far the most thoroughly documented calculator/computer HP (or maybe any Mfr) ever made. In addition to the full source listing, there are 2 other volumes dedicated to the s/w architecture and APIs, system buffers, storage formats etc. plus there are 3 more volumes for the h/w, 2 more volumes for HP-IL and another Volume for the Forth/Assembler ROM.

After seeing all the interest and 3rd party activity with the 41, HP wanted to provide all the "tools" to take the 71B (originally the HP-44 internally) to the next level. As the story goes though, 71B sales remained disappointing after that large investment, and the team never produced such thorough docs for a product again.

As you probably know, the 71 Forth ROM by BillW was the direct ancestor of RPL, and with the exception of Jim Donnelley's awesome "An Introduction to HP 48 System RPL and Assembly Language Programming" HP never really did extensive internals docs again.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
02-05-2015, 02:32 PM (This post was last modified: 02-05-2015 02:43 PM by Dieter.)
Post: #28
RE: Approximate pi to 24 digits via keyboard
(02-02-2015 06:46 PM)Rick314 Wrote:  Thank you Dieter. I found your table very interesting and quite a disappointment. It should be added to the HP-35S Bug List.

Then let's start a 41C bug list, a 67/97 bug list, any many others. Loss of accuracy in the sine function (and probably others) for arguments close to pi is a common problem. Let's look at our good old trusted and beloved 41C:

Code:
 x             41C sin(x)       comment
---------------------------------------------------
3,1           4,158066243 E-2   exact
3,14          1,592652917 E-3   almost exact
3,141         5,926533553 E-4   1 digit off
3,1415        9,265358987 E-5   2 digits off
3,14159       2,65359 E-6       3(4) digits lost *)
3,141592      6,5359 E-7        4(5) digits lost *)
3,1415926     5,359 E-8         5(6) digits lost *)
3,14159265    3,59 E-9          6(7) digits lost *)
3,141592653   5,9 E-10          7(8) digits lost *)
---------------------------------------------------
                                *) last digit is 0

I assume the 67/97, the 34C, 25/29 and other well-reputed HPs will behave in a similar way.

Dieter
Find all posts by this user
Quote this message in a reply
02-05-2015, 10:59 PM
Post: #29
RE: Approximate pi to 24 digits via keyboard
(02-05-2015 02:32 PM)Dieter Wrote:  
(02-02-2015 06:46 PM)Rick314 Wrote:  Thank you Dieter. I found your table very interesting and quite a disappointment. It should be added to the HP-35S Bug List.

Then let's start a 41C bug list, a 67/97 bug list, any many others. Loss of accuracy in the sine function (and probably others) for arguments close to pi is a common problem. Let's look at our good old trusted and beloved 41C:

Code:
 x             41C sin(x)       comment
---------------------------------------------------
3,1           4,158066243 E-2   exact
3,14          1,592652917 E-3   almost exact
3,141         5,926533553 E-4   1 digit off
3,1415        9,265358987 E-5   2 digits off
3,14159       2,65359 E-6       3(4) digits lost *)
3,141592      6,5359 E-7        4(5) digits lost *)
3,1415926     5,359 E-8         5(6) digits lost *)
3,14159265    3,59 E-9          6(7) digits lost *)
3,141592653   5,9 E-10          7(8) digits lost *)
---------------------------------------------------
                                *) last digit is 0

I assume the 67/97, the 34C, 25/29 and other well-reputed HPs will behave in a similar way.

Dieter

These are quite acceptable on the HP-34C, HP-41C/CV/CX, HP-10C, HP-11C, HP-15C and others, but NOT on the HP-33S (which replaced the HP-32S) and the HP-35S.

Gerson.
Find all posts by this user
Quote this message in a reply
02-06-2015, 11:16 AM
Post: #30
RE: Approximate pi to 24 digits via keyboard
Another way of seeing how many pi digits are used internally is to calculate the sine (in radians) of 10^10, 10^20, 10^30 etc and comparing with the true value, obtained with WolframAlpha:
Code:

SINRAD    WA                     HP42S                 HP41
10^10    -0.4875060250875...    -0.487506025088        -0.4880805565
10^20    -0.6452512852657...    -0.645251285266
10^30    -0.0901169019121...    -0.0910311968368
Easy to see that the results indicate 31 digits for the 42S and 13 for the 41C.

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
02-06-2015, 03:03 PM
Post: #31
RE: Approximate pi to 24 digits via keyboard
(02-05-2015 02:32 PM)Dieter Wrote:  Then let's start a 41C bug list, a 67/97 bug list, any many others. Loss of accuracy in the sine function (and probably others) for arguments close to pi is a common problem. Let's look at our good old trusted and beloved 41C:

Code:
 x             41C sin(x)       comment
---------------------------------------------------
3,1           4,158066243 E-2   exact
3,14          1,592652917 E-3   almost exact
3,141         5,926533553 E-4   1 digit off
3,1415        9,265358987 E-5   2 digits off
3,14159       2,65359 E-6       3(4) digits lost *)
3,141592      6,5359 E-7        4(5) digits lost *)
3,1415926     5,359 E-8         5(6) digits lost *)
3,14159265    3,59 E-9          6(7) digits lost *)
3,141592653   5,9 E-10          7(8) digits lost *)
---------------------------------------------------
                                *) last digit is 0

I assume the 67/97, the 34C, 25/29 and other well-reputed HPs will behave in a similar way.

Dieter

Just when I thought my trig routines for newRPL were good and stable...
I just tried this using SIN of all digits of PI except the last one, and my code produces only 10 good digits (worst case, varies with the selected precision).
So imagine you select a 500 digit precision and only get 10 good digits! What a joke, I need to work on that argument reduction. Granted, if you are close to pi with 499 digits matching, the value of those digits may have no practical meaning, but after reading this thread, I want newRPL to return the next 500 digits of pi Wink
Thanks to all the people who participate in discussions of this kind, now I'll be able to make sure this works properly.

Claudio
Find all posts by this user
Quote this message in a reply
02-06-2015, 04:10 PM
Post: #32
RE: Approximate pi to 24 digits via keyboard
(02-05-2015 02:32 PM)Dieter Wrote:  Then let's start a 41C bug list, a 67/97 bug list, any many others. Loss of accuracy in the sine function (and probably others) for arguments close to pi is a common problem. Let's look at our good old trusted and beloved 41C:

Code:
 x             41C sin(x)       comment
---------------------------------------------------
3,1           4,158066243 E-2   exact
3,14          1,592652917 E-3   almost exact
3,141         5,926533553 E-4   1 digit off
3,1415        9,265358987 E-5   2 digits off
3,14159       2,65359 E-6       3(4) digits lost *)
3,141592      6,5359 E-7        4(5) digits lost *)
3,1415926     5,359 E-8         5(6) digits lost *)
3,14159265    3,59 E-9          6(7) digits lost *)
3,141592653   5,9 E-10          7(8) digits lost *)
---------------------------------------------------
                                *) last digit is 0

I assume the 67/97, the 34C, 25/29 and other well-reputed HPs will behave in a similar way.

Dieter

I verified HP-67/97 HP34C HP29C, they compute the same values as above. But HP-21 HP-25/HP-25C both produce the same even less accurate values, interestingly with more decimals. Obviously they use a different algorithm.

Code:

3,141592653  1.160469873 E-9

Bernhard
Find all posts by this user
Quote this message in a reply
02-06-2015, 06:34 PM
Post: #33
RE: Approximate pi to 24 digits via keyboard
(02-06-2015 04:10 PM)PANAMATIK Wrote:  I verified HP-67/97 HP34C HP29C, they compute the same values as above.

That's what could be expected for calculators of that era.

(02-06-2015 04:10 PM)PANAMATIK Wrote:  But HP-21 HP-25/HP-25C both produce the same even less accurate values, interestingly with more decimals. Obviously they use a different algorithm.

The algorithms may even be similar, but the internal precision is not. Starting with the HP91, 67 and 97 in 1976 HP used 13 internal digits for most calculations to minimize roundoff errors. This was not yet available on earlier calculators like the 21 and 25 that appeared in 1975.

This is what HP Journal 1976-11 says on page 17 ("The New Acccuracy: Making 23 = 8" by Dennis W. Harms):
Quote:The second method of improving accuracy is to trap critical arguments and calculate the functions at these arguments in a special way. These critical arguments include numbers near 1 when calculating ln or log, numbers near 0 when calculating sin-1, cos-1, or tan-1, and numbers near zero or multiples of π/2 when calculating sin, cos, or tan.

(Emphasis added)

So indeed some algorithms have been updated in the "new accuracy calculators".

Dieter
Find all posts by this user
Quote this message in a reply
02-06-2015, 07:16 PM (This post was last modified: 02-06-2015 08:21 PM by Marcus von Cube.)
Post: #34
RE: Approximate pi to 24 digits via keyboard
WP 34S is a bit paranoid about range reduction for trigs in radians. The interval value of (2*)PI carries 451 digits. It used to be even more but we reduced it for space reasons to the present precision.

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
Find all posts by this user
Quote this message in a reply
02-07-2015, 06:25 AM (This post was last modified: 02-08-2015 01:26 PM by Werner.)
Post: #35
RE: Approximate pi to 24 digits via keyboard
@Marcus: yes, I noticed SIN(10^200) was still correct on the WP34S, and I gave up there ;-)
SIN(PI-10^-33) is only correct to 17 digits, however, not 34.

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
02-07-2015, 11:15 PM
Post: #36
RE: Approximate pi to 24 digits via keyboard
(02-07-2015 06:25 AM)Werner Wrote:  SIN(PI-10^-34) is only correct to 17 digits, however, not 34.

That's something for Pauli to investigate. He the algorithm guru in our little project.

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
Find all posts by this user
Quote this message in a reply
02-08-2015, 05:00 PM
Post: #37
RE: Approximate pi to 24 digits via keyboard
(02-07-2015 11:15 PM)Marcus von Cube Wrote:  That's something for Pauli to investigate. He the algorithm guru in our little project.

Of course it's pi – 10–33. ;-)

But yes, the sine of this has just 17 exact digits. On the one hand that's fine since accuracy beyond SP (16 digits) is not guaranteed. On the other hand, if a simple fix is possible...

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 




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