Javascript precision with math libraries
I am trying to do this calculation in javascript using Big.js
r = (a * b)/ sqrt( ( a*sin(θ) )^2 + ( b*cos(θ) )^2 )
I also tried math.js and got the same result.
You can see the discrepancy between Wolfram and Google's calculations since Google uses javascript. Wolfram [= 40] vs Google [= 43.4008369271]
I made this jsfiddle where you can see it working:
http://jsfiddle.net/herkulano/k1h5d4zk/
How do you solve it?
+3
source to share