Why not use: expf(myFloat); That's what it's for. On Thu, 20 Sep 2007, Blankenship, David wrote:
I am calling the exp function in a tight loop, a little over 238 million times. As expected, it takes a while, but it seemed to take longer than necessary, so I was looking into this. What I found was that if I call exp as I am with a single precision floating point value: exp( myFloat ); it takes a long time, but if I cast my single precision value to a double: exp( double(myFloat) ); it takes about 1/3 of the time to execute. This is fantastic, but I need to know why this works so I can fix my code to use this as well as updating any other code that might benefit from this change.