Skip to content

Commit 2d4373e

Browse files
authored
Update floating-point-support.md
Add a note to capture that floating point math functions can change between OS versions.
1 parent aa116a3 commit 2d4373e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/c-runtime-library/floating-point-support.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ For ISO C Standard 11 (C11) and later, the `<tgmath.h>` header, in addition to i
1313

1414
Many of the floating point math library functions have different implementations for different CPU architectures. For example, the 32-bit x86 CRT may have a different implementation than the 64-bit x64 CRT. In addition, some of the functions may have multiple implementations for a given CPU architecture. The most efficient implementation is selected dynamically at run-time depending on the instruction sets supported by the CPU. For example, in the 32-bit x86 CRT, some functions have both an x87 implementation and an SSE2 implementation. When running on a CPU that supports SSE2, the faster SSE2 implementation is used. When running on a CPU that doesn't support SSE2, the slower x87 implementation is used. Because different implementations of the math library functions may use different CPU instructions and different algorithms to produce their results, the functions may produce different results across CPUs. In most cases, the results are within +/-1 ULP of the correctly rounded result, but the actual results may vary across CPUs.
1515

16+
Precision and accuracy of the floating point math library functions can receive improvements with newer versions of the UCRT. Since the UCRT is a part of the Windows operating system, this means that you may observe different results for these functions between operating system versions or between debug and release. It is not recommended, but if you must assume these functions will produce identical results everywhere, statically link to the UCRT to guarantee consistent results.
17+
1618
Previous 16-bit versions of Microsoft C/C++ and Microsoft Visual C++ supported the **`long double`** type as an 80-bit precision floating-point data type. In later versions of Visual C++, the **`long double`** data type is a 64-bit precision floating-point data type identical to the **`double`** type. The compiler treats **`long double`** and **`double`** as distinct types, but the **`long double`** functions are identical to their **`double`** counterparts. The CRT provides **`long double`** versions of the math functions for ISO C99 source code compatibility, but note that the binary representation may differ from other compilers.
1719

1820
## Supported math and floating-point routines

0 commit comments

Comments
 (0)