help-octave
[Top][All Lists]

## Re: If pi is so accurate why it's not producing that accurate result.

 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.

Sent: Saturday, March 24, 2018 12:45:25 AM
Subject: Re: If pi is so accurate why it's not producing that accurate result.

The answer is truly helpful and on the other side to the point.
Thanks NickJ.

--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html