We value your feedback.

Take our survey and automatically be enter to win anyone of the following:

Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Perhaps faster still is this:

inline float fastFunc (float x){

return ( ((*(long*)&x) >> 31) ? x : -x);

}

This function simply loads the operand (x), shifts it right 31 places, and if the remaining bit is a 1 (which meant that the original value was negative) it returns that value. If the remaining bit is 1, it negates the value before returning it.

This function should be smaller and faster than either of the first two.

Good Luck!

Kent