Post Reply 
sin(x) & cos(x) for x = 10²² in radians
10-06-2023, 04:19 PM (This post was last modified: 10-06-2023 04:22 PM by Jlouis.)
Post: #41
RE: sin(x) & cos(x) for x = 10²² in radians
(10-06-2023 08:40 AM)J-F Garnier Wrote:  [quote='Albert Chan' pid='178067' dateline='1696540801']

I should just try it! No table, just many digits of pi.

>sin(1e22)
-.852200849762
>sin(1e33)
-5.11830428837E-2

The main goal of the PI/4 double precision value was not to manage huge exact arguments, since this has no real-life interest and there will always be a limit unless storing 500 digits, but to guarantee 12-digit accuracy trig results for all "realistic" arguments, especially SIN(X) with X close to PI.

J-F

Exactly J-F.

I'm proud of my Saturn calculators.

But although all of us are crazy about accuracy, is there any practical job of sin 1E22?

Maybe an intergalctical travel?

I suppose NASA went to the moon using sliderules or some extremely limited computers

But there are lots of fun in this discussions, it is being a wonderfull thread.

Cheers

JL

Edit. I'm a little bit disappointed of my pre Saturn calculators. I'm thinking throwing all out cheap on TAS. Smile
Find all posts by this user
Quote this message in a reply
10-06-2023, 05:02 PM
Post: #42
RE: sin(x) & cos(x) for x = 10²² in radians
(10-06-2023 03:19 PM)Albert Chan Wrote:  
(10-06-2023 08:40 AM)J-F Garnier Wrote:  Actually, the Saturn machines are using the PI/4 constant with 31 digits.

Thanks for the info.

I still think code somehow adjusted stored 31-digits pi/4 (error ≈ -1/4 ULP)
Otherwise, it cannot match HP71B SIN(x) signatures.

Comment from the trig code:
"The absolute value of the argument is reduced by 2*Pi, then by Pi/2, and Pi/4."

The 2*Pi value is derived from Pi/4 by successive doubling, then truncated (not rounded) to 31 digits:
so 2*Pi is 6.283185307179586476925286766559
which is a very good value for 2*Pi !

I can't imagine HP did it in that way by chance.

J-F
Visit this user's website Find all posts by this user
Quote this message in a reply
10-07-2023, 01:53 AM
Post: #43
RE: sin(x) & cos(x) for x = 10²² in radians
About R language:

sin(10^22) = sin(10**22) = sin(1e22) = sin(1E22) = −0.852 200 8

cos(10^22) = cos(10**22) = cos(1e22) = cos(1E22) = 0.523 214 8

About Python:

import math

print(math.sin(10**22)) = print(math.sin(pow(10, 22))) = −0.852 200 849 767 188 8

print(math.cos(10**22)) = print(math.cos(pow(10, 22))) = 0.523 214 785 395 139

Bruno
Sanyo CZ-0124 ⋅ TI-57 ⋅ HP-15C ⋅ Canon X-07 + XP-140 Monitor Card ⋅ HP-41CX ⋅ HP-28S ⋅ HP-50G ⋅ HP-50G
Find all posts by this user
Quote this message in a reply
Post Reply 




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