Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 9/08/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

fimf-accuracy-bits, Qimf-accuracy-bits

Defines the relative error for math library function results, including division and square root.

Syntax

Linux:

-fimf-accuracy-bits=bits[:funclist]

macOS:

-fimf-accuracy-bits=bits[:funclist]

Windows:

/Qimf-accuracy-bits:bits[:funclist]

Optional argument funclist is not supported for ifx.

Arguments

bits

Is a positive, floating-point number indicating the number of correct bits the compiler should use.

The format for the number is [digits] [.digits] [ { e | E }[sign]digits].

funclist

Is an optional list of one or more math library functions to which the attribute should be applied. Do not specify the standard Fortran name of the math function; you must specify the actual math library name. If you specify more than one function, they must be separated with commas.

Precision-specific variants like sin and sinf are considered different functions, so you would need to use -fimf-accuracy-bits=23:sin,sinf (or /Qimf-accuracy-bits:23:sin,sinf) to specify the relative error for both the single-precision and double-precision sine functions.

You also can specify the symbol /f to denote single-precision divides, symbol / to denote double-precision divides, symbol /l to denote extended-precision divides, and symbol /q to denote quad-precision divides. For example you can specify -fimf-accuracy-bits=10.0:/f or /Qimf-accuracy-bits:10.0:/f.

Default

-fimf-precision=medium or /Qimf-precision:medium

The compiler uses medium precision when calling math library functions. Note that other options can affect precision; see below for details.

Description

This option defines the relative error, measured by the number of correct bits, for math library function results.

The following formula is used to convert bits into ulps: ulps = 2p-1-bits, where p is the number of the target format mantissa bits (24, 53, and 113 for single, double, and quad precision, respectively).

This option can affect run-time performance and the accuracy of results.

If you need to define the accuracy for a math function of a certain precision, specify the function name of the precision that you need. For example, if you want double precision, you can specify :sin; if you want single precision, you can specify :sinf, as in the following:

Linux and macOS

  • -fimf-accuracy-bits=23:sinf,cosf,logf

  • -fimf-accuracy-bits=52:sqrt,/,trunc

  • -fimf-accuracy-bits=10:powf

Windows

  • /Qimf-accuracy-bits:23:sinf,cosf,logf

  • /Qimf-accuracy-bits:52:sqrt,/,trunc

  • /Qimf-accuracy-bits:10:powf

If you do not specify any function names, then the setting applies to all functions (and to all precisions). However, as soon as you specify an individual function name, the setting applies only to the function of corresponding precision. So, for example, sinf applies only to the single-precision sine function, sin applies only to the double-precision sine function, sinl applies only to the extended-precision sine function, etc.

There are three options you can use to express the maximum relative error. They are as follows:

Linux and macOS

  • -fimf-precision

  • -fimf-max-error

  • -fimf-accuracy-bits

Windows

  • /Qimf-precision

  • /Qimf-max-error

  • /Qimf-accuracy-bits

If more than one of these options are specified, the default value for the maximum relative error is determined by the last one specified on the command line.

If none of the above options are specified, the default values for the maximum relative error are determined by the setting of the following options:

  • [Q]fast-transcendentals (ifort only)

  • [Q]prec-div (ifort only)

  • [Q]prec-sqrt (ifort only)

  • -fp-model (Linux and macOS) or /fp (Windows)

NOTE:

Many routines in libraries LIBM (Math Library) and SVML (Short Vector Math Library) are more highly optimized for Intel® microprocessors than for non-Intel microprocessors.

NOTE:

The standard Fortran names for the various math intrinsic functions do not match the math library names of the math intrinsic functions. You must find the actual math library name that is generated for the relevant Fortran math intrinsic.

One way to do this is to generate assembly code by using one of the following options:

Linux and macOS

-S

Windows

/Fa or /S

The assembly code will show the actual math library name.

For example, if you create a program that contains a call to SIN(x) where x is declared as REAL(KIND=4) and then use option S to produce assembly code for the program, the assembly code will show a call to sinf.

To request the relative error for the single-precision sine function, you should specify:

Linux and macOS

-fimf-accuracy-bits=sinf

Windows

/Qimf-accuracy-bits:sinf

NOTE:

This option only applies to host compilation. When offloading is enabled, it does not impact device-specific compilation. Offloading can only be enabled when using ifx.

Product and Performance Information

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.

Notice revision #20201201

IDE Equivalent
None
Alternate Options

None