Re: Math Performance(exp)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux