Closed HageMaster3108 closed 9 years ago
yes, I imagine you're correct.
Using the javascript console in chrome, I see that :
Math.asin(0.5) * 180/Math.PI 30.000000000000004
Also :
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math
Note that the trigonometric functions (sin(), cos(), tan(), asin(), acos(), atan(), atan2()) expect or return angles in radians. To convert radians to degrees, divide by (Math.PI / 180), and multiply by this to convert the other way. Note a lot of the math functions have a precision that's implementation-dependent. This means that different browsers can give a different result, and even the same JS engine on a different OS or architecture can give different results.
So, I'm not sure what can be done about this apart from adding a set of special cases with known and precise answers.
I'm going to close this - please re-open if you have a suggestion (prefer a PR, but hey).
When I calculate sin^-1 0.5 i end up with 30.000000000000004 but it should be just exact 30
I guess this is down to floating point precision?