help-octave
[Top][All Lists]

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

 From: Sergei Steshenko Subject: Re: If pi is so accurate why it's not producing that accurate result. Date: Fri, 23 Mar 2018 19:11:07 +0000 (UTC)

```

________________________________
Sent: Friday, March 23, 2018 10:06 PM
Subject: If pi is so accurate why it's not producing that accurate result.

I checked pi is almost accurate to 1000 digits. WoWww.

But in this cases,

>> cos(pi/2)

ans =    6.1232e-17

>> tan(pi/2)

ans =    1.6331e+16

the result is not that accurate,not even close to infinite or zero.

Can anyone tell why so?

--

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

-----------------------------------------------------------------------------

"the result is not that accurate,not even close to infinite or zero" - huh ?

Max value of 'cos' is 1; 1e-17 means -340db; 6.1232e-17 is better than -320db.

So, what else do you want ?

Do you at all understand how floating point math works and how 'sin' and 'cos'
are implemented in SW and HW ?

--Sergei.

```