4.9. Floating-Point DivisionΒΆ
Floating-point division operations can be costly. Often, a division operation results in a run-time-support call to a predefined function that implements floating-point division. Such calls prevent software pipelining.
If your code divides by a constant
that is known at compile time, consider pre-calculating the1/constant
value and replacing the division operation with a multiplication by 1/constant
. The compiler automatically performs this optimization only if the 1/constant
value can be precisely represented in an IEEE-754 float or double.