Post Reply 
sine of an angle in degree mode
01-24-2018, 12:28 PM (This post was last modified: 01-24-2018 01:45 PM by Thomas Okken.)
Post: #13
RE: sine of an angle in degree mode
(01-24-2018 12:06 PM)rflesch Wrote:  I would assume that no algorithm in the known galaxy could calculate sin(180deg) exactly, because the value is a real number, i.e. "0.00000(...)". I would greatly appreciate if somebody could tell me if I am wrong here.

You are wrong.

You don't appear to be familiar with the concept of argument reduction.

The trigonometric functions are all periodic, meaning sin(x) = sin (x + 2 * n * pi), for all x ∈ R and all n ∈ Z, and similar for cos, tan, etc.

Since the algorithms used to calculate these functions are all iterative with rapid convergence only within a narrow interval, the identity above is used to reduce the argument, by taking its remainder modulo 2pi, or, in degrees, modulo 360. In radians, this reduction cannot be exact in finite precision, because of the irrationality of pi, but in degrees, it is exact.

Within the range 0 to 2pi, or 0 to 360°, the argument can be reduced further, by using trigonometric identities like sin(x) = sin(pi - x), which are also exact when performed in degrees.

The end result is that, through argument reduction, all those special values you mentioned are reduced to exactly zero, without any of them actually being treated as a special case.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
sine of an angle in degree mode - rflesch - 01-24-2018, 09:38 AM
RE: sine of an angle in degree mode - Thomas Okken - 01-24-2018 12:28 PM



User(s) browsing this thread: 1 Guest(s)