Re: C's trig functions
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Tue, 26 Apr 2005 00:03:49 GMT
John Smith <JSmith@xxxxxxxx> writes:
> I just broke up with my girlfriend, so, to sublimate my sexual
> tensions, I began reading this:
>
> http://forensics.calcinfo.com/
>
> This guy has developed a method that he uses to determine chip lineage
> in old calculators (he needs a girlfriend too). Various chips will
> produce various results when you make this calculation:
>
> n = sin(cos(tan(atan(acos(asin(9.0)))))) in degrees.
What do you expect asin(9.0) to do? asin() expects an argument in the
range -1.0 to +1.0, and returns an angle (normally in radians); it
fails if its argument is outside that range. Converting asin()'s
argument from degrees to radians makes no mathematical sense; if you
want to work in degrees, you need to convert the *result* from radians
to degrees.
> With the Windows calculator I get the following results starting with
> sin(9.0)in degree mode:
[...]
Starting with sin(9.0) is inconsistent with the expression above. I
suspect what you mean is:
n = asin(acos(atan(tan(cos(sin(9.0))))))
(where 9.0 is in degrees).
As you know, unlike most interactive calculators, C's trig functions
have no "degree mode", which is why you need to do the conversions
manually. The C equivalent of sin(x), where x is expressed in
degrees, would be sin(DEG2RAD(x)). The C equivalent of asin(x), where
the result is to be expressed in degrees, would be RAD2DEG(asin(x)).
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
- Follow-Ups:
- Re: C's trig functions
- From: John Smith
- Re: C's trig functions
- References:
- C's trig functions
- From: John Smith
- C's trig functions
- Prev by Date: Re: struct type completion
- Next by Date: Re: struct type completion
- Previous by thread: Re: C's trig functions
- Next by thread: Re: C's trig functions
- Index(es):
Relevant Pages
|