# Intel® Math Library

The Intel® oneAPI DPC++/C++ Compiler includes a mathematical software library containing highly optimized and very accurate mathematical functions. These functions are commonly used in scientific or graphic applications, as well as other programs that rely heavily on floating-point computations. To include support for C99 _Complex data types, use the [Q]std=c99 compiler option.

Many routines in the Intel® Math Library are more optimized for Intel® microprocessors than for non-Intel microprocessors.

The mathimf.h header file includes prototypes for Intel® Math Library functions.

### Note

Intel's math.h header file is compatible with the GCC* Math Library `libm`, but it does not cause the GCC Math Library to be linked. The source can be built with gcc or icx. Intel Math Library is linked when you build with icx. The header file for the Intel Math Library mathimf.h contains additional functions that are found only in the Intel Math Library. The source can only be built using the Intel oneAPI DPC++/C++ Compiler and libraries.

The long double functions, such as `expl` or `logl`, in the Intel Math Library are ABI incompatible with the Microsoft* libraries. The Intel compiler and libraries support the 80-bit long double data type (see the description of the Qlong-double option). For maximum compatibility, use math.h or mathimf.h header files along with the Intel Math Library.

## Intel Math Libraries for Linux*

The math library linked to an application depends on the compilation or linkage options specified.

Library | Description
--- | ---
libimf.a | Default static math library.
libimf.so | Default shared math library.

### Note

The Intel Compiler Math Libraries contain performance-optimized implementations for various Intel platforms. By default, the best implementation for the underlying hardware is selected at runtime. The library dispatch of multi-threaded code may lead to apparent data races, which may be detected by certain software analysis tools. However, as long as the threads are running on cores with the same CPUID, these data races are harmless and are not a cause for concern.

## Intel Math Libraries for Windows*

The math library linked to an application depends on the compilation or linkage options specified.

Library | Option | Description
--- | --- | ---
libm.lib |  | Default static math library.
libmmt.lib | /MT | Multi-threaded static math library.
libmmd.lib | /MD | Dynamically linked math library.
libmmdd.lib | /MDd | Dynamically linked debug math library.
libmmds.lib |  | Static version compiled with /MD option.

## oneAPI and OpenCL™ Considerations

Currently, oneAPI uses the OpenCL Specification to determine the ULP accuracy for OpenCL mathematical functions. Details about their precision and accuracy, including tables for single and double precision functions, are available from the Khronos* OpenCL Specification's section, Relative Error as ULPs.

Mathematical functions have different accuracy levels on different devices. The OpenCL specification sets a limit on the maximum ULP error (where applicable), but individual devices may provide a more accurate implementation. If the OpenCL implementation is optimized for CPU usage, using the same code may not work on a GPU device.

Parent topic: Optimization and Programming Guide

- Using the Intel® Math Library
- Math Functions

## See Also

Function List
Qlong-double compiler option
MD compiler option
MT compiler option
std, Qstd compiler option
Using the Intel® Math Library