问题
What methods would a modern FPU use to compute transcendental functions?
For example, Intel CPUs provide instructions such as FSIN
, FCOS
, FYL2X
, etc. I am curious as to what algorithms would be used to actually implement these in hardware.
My naïve guess would be Taylor series perhaps combined with some lookup tables, but that's nothing more than a wild guess. Please enlighten me.
P.S. This question is more general than just Intel hardware.
回答1:
One place to start could be "New Algorithms for Improved Transcendental Functions on IA-64" by Shane Story and Ping Tak Peter Tang, both from Intel. It probably doesn't have as many details as you might like, but it includes several references.
Update 08/13/2014
The original link is broken. IEEE's public abstract/citation page can be found here:
http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=762822&tag=1
回答2:
In hardware (as well as software where hardware multiply instruction is not available) it is usually implemented in CORDIC since this requires only addition, subtraction, bit shift and table lookup
Related:
- How does C compute sin() and other math functions?
- How are sin and cos implemented hardware wise?
- What algorithm is used by computers to calculate logarithms?
- How do computers calculate sin values?
- How does the computer calculate Square roots?
来源:https://stackoverflow.com/questions/13877303/what-algorithms-do-fpus-use-to-compute-transcendental-functions