I have a function that takes an angle in degrees and converts
it to radians. From there it takes the cosine of that angle and
multiplies it by another number. The problem is the result of the
Math.cos is way off.
The first line of code is this:
var theAngle = Math.abs(myAngle)*Math.PI/180;
myAngle is = -90. the result is that theAngle becomes
From there I have this line of code:
var objAcc = grav * Math.cos(theAngle);
note that grav is set to .45. I've double checked in the
debugger and theAngle is still equal to the above listed number.
So, the result SHOULD be that objAcc should be equal to
-1.5711675124992e-15. HOWEVER, it is actually being set to
-1.72286501471525e-1. Is there something I don't know about working
with Math.cos? If I run the function and put in the number itself
instead of a variable it works out fine. It's just that when I have
the variable in there it screws it up.