Why is the gcc math library so inefficient?
问题 When I was porting some fortran code to c, it surprised me that the most of the execution time discrepancy between the fortran program compiled with ifort (intel fortran compiler) and the c program compiled with gcc, comes from the evaluations of trigonometric functions ( sin , cos ). It surprised me because I used to believe what this answer explains, that functions like sine and cosine are implemented in microcode inside microprocessors. In order to spot the problem more explicitly I made a