2 Replies Latest reply on May 1, 2006 2:18 PM by Kolja1987

Calculating arc tangent of 0.12 degrees

ActionScript really does know to be annoyed sometimes!

I'm trying to calculate arc tangent of a number.
I'm using the following code:

arctg_mi = Math.atan(Math.PI/180 * 0.12)

As you can see, I need to calculate arc tangent of 0.12 degrees. Problem is that it just cannot be done. I'm not an expert of mathematics, but it seems that radian system does not behave like degrees system when it comes to arc tangent!
I used Windows' Calculator, and arc tangent of 0.12 in degrees system is about 6.84, which is right. But when I switch to radian system, then convert 0.12 degrees to radians, and then try to calculate, I get the wrong value. Totally wrong!
Solution? Either I am so stupid that I missed some ordinary procedure in all of this, or these two systems are not comparable.
Or do I need to convert the value I get back to degrees system somehow?

The easiest thing to do would be to switch Flash to degrees system, but that can't be done, so...

• 1. Re: Calculating arc tangent of 0.12 degrees
It comes out to 6.84 in Flash too, if you do it right. First off, degrees
per radian is 180/Pi not Pi/180. And you want to get the arctangent of the
value, which comes out in radians, then convert to degrees - you don't want
to take the arctangent of the degrees....

So:
var degreesPerRadian = 180.0 / Math.PI;

6.84277341263094

HTH

--
Dave -