|
From: | Montgomery-Smith, Stephen |
Subject: | Re: If pi is so accurate why it's not producing that accurate result. |
Date: | Sat, 24 Mar 2018 21:32:51 +0000 |
Here is another thing to think about. Let us denote by tpi the true value of pi, and by npi the numerical value of pi in IEEE double precision arithmetic. Now we have the identities
cos(tpi/2-x) = sin(x)
tan(tpi/2-x) = cot(x) = 1/tan(x).
Now npi/2 = tpi/2-x where x is of the order of 1e-16. And for small x, we have the approximation (here ~= denotes approximately equal to):
sin(x) ~= x
tan(x) ~= x.
So we obtain
cos(npi/2) ~= (tpi-npi)/2
tan(npi/2) ~= 2/(tpi/npi)
And this is exactly what you get.
[Prev in Thread] | Current Thread | [Next in Thread] |