Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

/Qprec-div

mattsdad
Beginner
658 Views

The compiler documentation says /Qprec-div improves precision of floating-point divides.

Does that mean that if /Qprec-div is not used that the floating-point divides are not as precise as they can be?

0 Kudos
2 Replies
Steven_L_Intel1
Employee
658 Views

Did you read the full text of the documentation? It says:

Description

This option improves precision of floating-point divides. It has a slight impact on speed.

With some optimizations, such as -xN and -xB (Linux) or /QxN and /QxB (Windows), the compiler may change floating-point division computations into multiplication by the reciprocal of the denominator. For example, A/B is computed as A * (1/B) to improve the speed of the computation.

However, sometimes the value produced by this transformation is not as accurate as full IEEE division. When it is important to have fully precise IEEE division, use this option to disable the floating-point division-to-multiplication optimization. The result is more accurate, with some loss of performance.

If you specify -no-prec-div (Linux and Mac OS) or /Qprec-div- (Windows), it enables optimizations that give slightly less precise results than full IEEE division.

The default is that /Qprec-div is "on", so that the optimization is not done. You can get better performance by specifying /Qprec-div- to allow the additional optimization which may change low-order results. Most applications would not notice.

0 Kudos
TimP
Honored Contributor III
658 Views

/Qno-prec-div permits the compiler to perform optimizations such as replacing division by reciprocal multiplication, when there is an invariant divisor. Single precision vectorizable division might be performed bya Newton approximation scheme. The results will not be identical to IEEE standard, and extreme cases run into problems with overflow. Where sqrt is involved, there are similar tricks controlled by /Qprec-sqrt.

-fp-model: precise (also strict and the like) incorporate prec-div and prec-sqrt.

0 Kudos
Reply