3 ms·
You need more digits than that to accurately compute double-precision trigonometric functions (if the input is close to pi, you need enough accurate digits left
by rlanday 8y ago
You need more digits than that to accurately compute double-precision trigonometric functions (if the input is close to pi, you need enough accurate digits left after performing range reduction).
This paper claims you need 2/pi accurate to 1144 bits which is about 345 decimal digits:
https://www.csee.umbc.edu/~phatak/645/supl/Ng-ArgReduction.pdf https://www.csee.umbc.edu/~phatak/645/supl/Ng-ArgReduction.p...
- ectospheno 8y agoAs a counterpoint, no real computation I've performed on a computer needed to compute the cos of 2^1023 radians. I can't imagine such a scenario either.
- rlanday 8y agoYou can either implement the functions accurately or inaccurately. Implementing them inaccurately is a slippery slope. Intel botched the hardware implementations in their processors not only for large inputs but also for inputs nearish to multiples of pi: http://notabs.org/fpuaccuracy/index.htm http://notabs.org/fpuaccuracy/index.htm