HP Forums
sin(x) & cos(x) for x = 10²² in radians - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not quite HP Calculators - but related (/forum-8.html)
+--- Thread: sin(x) & cos(x) for x = 10²² in radians (/thread-20577.html)

Pages: 1 2 3


RE: sin(x) & cos(x) for x = 10²² in radians - Jlouis - 10-06-2023 04:19 PM

(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


RE: sin(x) & cos(x) for x = 10²² in radians - J-F Garnier - 10-06-2023 05:02 PM

(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


RE: sin(x) & cos(x) for x = 10²² in radians - FLISZT - 10-07-2023 01:53 AM

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