Known Limitations with -Qlong-double on Windows*

ID 685679
Updated 11/16/2021
Version Latest



The use of the -Qlong-double command line option on Windows platforms mandates that any source code using double extended precision floating-point types (FP80) be carefully segregated from source code that was not written in a way that considers or supports their use. Source code which makes assumptions or has requirements on the size or layout of an FP80 value may experience a variety of failures at compile time, link time, or run time when this option is used. The Microsoft C Standard Library and Microsoft C++ Standard Template Library do not support FP80 datatypes. In all circumstances, please check with your library vendor whether they support FP80 datatype formats.

For example, note that the Microsoft* compiler and Microsoft-provided library routines (such as printf or long double math functions) do not provide support for 80-bit floating-point values. As a result, this option should only be used when referencing symbols within parts of your application built with this option or symbols in libraries that were built with this option.

In particular with the Microsoft Visual Studio 2019 version 16.10 release and subsequent releases, you may encounter compilation errors when using the options /std:c++latest /Qlong-double with a program that includes (even indirectly) the <complex> header, <xutility> header or the <cmath> header, which is expected, e.g.,

Here’s an example of the issue:

#include <iostream>
#include <complex>

int main()
{long double ld2 = 1256789.98765432106L;int iNan = isnan(ld2);std::cout << "Hello World!\n"; }

ksh-3.2$ icl -c -EHsc -GR    -std:c++latest /Qlong-double /MD  test1.cpp
Intel(R) C++ Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version xxx Build xxxx
Copyright (C) 1985-2021 Intel Corporation.  All rights reserved.

c:/Program files/Microsoft Visual Studio/2022/Preview/VC/Tools/MSVC/14.29.30130/include/xutility(5918): error: no instance of function template "std::_Bit_cast" matches the argument list
            argument types are: (const long double)
      const auto _Bits = _Bit_cast<_Uint_type>(_Xx);
c:/Program files/Microsoft Visual Studio/2022/Preview/VC/Tools/MSVC/14.29.30130/include/xutility(67): note: this candidate was rejected because at least one template argument could not be deduced
  _NODISCARD _CONSTEXPR_BIT_CAST _To _Bit_cast(const _From& _Val) noexcept {
          detected during:
            instantiation of "auto std::_Float_abs_bits(const _Ty &) [with _Ty=long double, <unnamed>=0]" at line 5967
            instantiation of "bool std::_Is_finite(_Ty) [with _Ty=long double, <unnamed>=0]" at line 1307 of "c:/Program files/Microsoft Visual Studio/2022/Preview/VC/Tools/MSVC/14.29.30130/include/cmath"
            instantiation of "_Ty std::_Common_lerp(_Ty, _Ty, _Ty) noexcept [with _Ty=long double]" at line 1392 of "c:/Program files/Microsoft Visual Studio/2022/Preview/VC/Tools/MSVC/14.29.30130/include/cmath"

compilation aborted for test1.cpp (code 2)