Comment #8 on issue 3006 by [email protected]: Inaccurate sin/cos values
http://code.google.com/p/v8/issues/detail?id=3006

A few things to consider:

- The ECMA script specification clearly states that Math.sin/cos are implementation-dependent approximations. There is no guarantees required regarding precision. - The glibc implementation of sin and cos itself is inconsistent depending on whether it's the 32 bit version using FPU or the 64 bit version using SSE. It's not accurate by your definition at all. - In case of cos(2^120), is 0 more or less precise than 0.47796506772457525, when the actual result should be roughly -0.925879? - Digital sampling inherently accepts rounding errors. I could argue that always rounding down is less precise than rounding to the nearest. In that case, rounding -7e-14 to 0 is more precise. - The new implementation of Math.tan(Math.PI/2) returns Infinity, not 16331778728383844. Is that closer to the truth? - I can assure you that my current approximation is a lot more accurate than 2-3 terms of Taylor expansion. - Math.PI is only a double precision approximation to begin with, namely 3.141592653589793. What comes after would be ...2384626..., an error of ~2.38e-16. That multiplied by 2200 is an error of ~4.7e-13, That seems a lot worse than -7e-14. - The approximation is not simply a table lookup of one value. It's a cubic spline interpolation depending on two closest samples including derivatives. The test case I wrote alongside the new approximation uses tailor expansions with 25 terms as reference. Testing it against a set of randomly and manually chosen values, the error rms of glibc is 8.696e-14, the error rms of the new approximation is 8.723e-14. Yes, if you compare the result bit patterns, they do differ, but the one is just a good guess as the other. I gladly accept the negligible loss of precision for more than twice the performance.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to