Comment #9 on issue 3006 by [email protected]: Inaccurate sin/cos values
http://code.google.com/p/v8/issues/detail?id=3006
1. The intent is clear though. You should try to do a reasonably good job.
and certainly not be much worse than Sun's fdlibm.
2. Please provide an example of this difference. With Sun's open source
fdlibm, there's no excuse to be gratuitously different on x87 or sse.
3. They are both wrong. -0.92... is the correct answer. Kahan says so
somewhere, but I cannot find the link.
4. Yes, the webaudio test is probably incorrect for not rounding to nearest.
5. As you rightly point out, Math.PI is not pi. Hence Math.PI/2 is not
pi/2. Hence tan(Math.PI/2) SHOULD NOT return infinity, since that can only
happen for tan(pi/2).
6. You misinterpreted what I said. I said use sin(x+e) = sin(x)*cos(e) +
cos(x)*sin(e). With your huge table, e is smaller than pi/2/2048 (I think).
2-3 terms of the Taylor series will allow you to compute sin(e) or cos(e)
to full double-precision accuracy.
7a. Yes, what you say about the error between 2200*Math.PI and 2200*pi is
true. But the trig function is given the exact rational value of
7599278835186801/2^40. The sin of that is -7.04e-14. Granted, you need
accurate pi reduction to get this, which you aren't currently doing, I
think, but fdlibm does.
b. Accuracy of math functions is almost always done using max relative
error. Using RMS tends to hide errors because they all get averaged
together.
c. No, you cannot say one is as good as the other. For a rational x,
cos(x) has exactly one mathematical value. The better one is the one
closest to that mathematical value.
d. I prefer slow and more accurate to fast and less accurate. With the
former I have high confidence things are computed correctly. With latter,
it's much harder to trust the results because I don't know what the
accuracy is. Anybody can do fast and inaccurate. The real trick and art is
to do fast AND accurate.
--
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.