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

Responding to #3. You are making unwarranted assumptions on the meaning of 1000000 as a double float. 1000000 can be represented EXACTLY as a double-precision IEEE754 floating point value. It is exactly 1000000 and no other. cos(1000000) has exactly one value, roughly, 0.93675212753314478693853253507.... The same holds for 2^120. It has an exact representation in double-precision and cos(2^120) has exactly one value.

System libraries should strive to be as accurate as possible. If a user wants to trade-off accuracy for speed, then it's quite easy. Doing it accurately is hard, so the system implementation should be as accurate as possible.

Consider what Kahan (primary architect of the IEEE754 standard) has to say: http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf, section 13, page 25:

13 Prevalent Misconceptions about Floating-Point Arithmetic :
 1• Floating–point numbers are all at least slightly uncertain.


And given that your current implementation has a large table of sin/cos values, you would have more accurate results using sin(x) = sin(y+e) = sin(y)*cos(e)+cos(y)*sin(e), where y is a value from your table. cos(e) and sin(e) could be evaluated very accurately using 2-3 terms of the Taylor expansion. This might be competitive in speed.

--
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