help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sine and cosine functions


From: André Pereira
Subject: Sine and cosine functions
Date: Thu, 2 May 2013 00:55:34 +0100

Good evening

 

I installed Octave today, and I came by a problem:

If I ask for the value of cos(pi) it returns -1, however if I ask for the value of sin(pi) it returns a value with an order of magnitude of -17.

Obviously, sin(pi) is 0. Although the value returned is of insignificant magnitude, the fact is, it is not 0. In fact, if I ask for the cosine or the sine of pi/2 it will not return 0 nor 1.

 

Rounding the values would be a logical way to solve this, but I reckon it might cause some problems with other angle values.

 

So what I wanted to ask you is if this is a problem that arises because of the limited digits the computer is allowed to use or if there is some way to work around this without compromising the accuracy of other calculations.

Thank you

André Pereira


reply via email to

[Prev in Thread] Current Thread [Next in Thread]