Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference

ID 767253
Date 11/07/2023
Public

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

Document Table of Contents

Qlong-double

Changes the default size of the long double data type.

Syntax

Linux:

None

Windows:

/Qlong-double

Arguments

None

Default

OFF

The default size of the long double data type is 64 bits.

Description

This option changes the default size of the long double data type to 80 bits.

However, the alignment requirement of the data type is 16 bytes, and its size must be a multiple of its alignment, so the size of a long double on Windows* is also 16 bytes. Only the lower 10 bytes (80 bits) of the 16 byte space will have valid data stored in it.

NOTE:

Using the Qlong-double command-line option on Windows* platforms requires 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. When this option is used, source code that 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 runtime.

The Microsoft* C Standard Library and Microsoft* C++ Standard Template Library do not support FP80 datatypes. In all circumstances where you want to use this option, please check with your library vendor to determine whether they support FP80 datatype formats.

For example, 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 and should not be called from code compiled with the Qlong-double command-line option.

Starting with the Microsoft Visual Studio 2019 version 16.10 release, you may get compilation errors when using options /std:c++latest together with /Qlong-double in programs that directly or indirectly include the <complex> header, <xutility> header, or the <cmath> header. To see an example of this, see the Example section below.

IDE Equivalent

None

Alternate Options

None

Example

In the Note above, we mention an issue with using the options /std:c++latest together with /Qlong-double in programs that directly or indirectly include the <complex>, <xutility>, or the <cmath> headers. The following shows an example of this issue:

#include <iostream>
#include <complex>

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

ksh-3.2$ icx -c -EHsc -GR    -std:c++latest /Qlong-double /MD  test1.cpp

test1.cpp
c:/Program files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/include\xutility(5971,24): error:
      no matching function for call to '_Bit_cast'
    const auto _Bits = _Bit_cast<_Uint_type>(_Xx);
                       ^
c:/Program files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/include\xutility(6014,12): note:
      in instantiation of function template specialization
      'std::_Float_abs_bits<long double, 0>' requested here
    return _Float_abs_bits(_Xx) < _Traits::_Shifted_exponent_mask;
           ^
c:/Program files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/include\cmath(1239,31): note:
      in instantiation of function template specialization 'std::_Is_finite<long
      double, 0>' requested here
    const bool _T_is_finite = _Is_finite(_ArgT);
                              ^
c:/Program files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/include\cmath(1324,12): note:
      in instantiation of function template specialization
      'std::_Common_lerp<long double>' requested here
    return _Common_lerp(_ArgA, _ArgB, _ArgT);
           ^
c:/Program files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/include\xutility(66,36): note:
      candidate template ignored: requirement
      'conjunction_v<std::integral_constant<bool, false>,
      std::is_trivially_copyable<unsigned long long>,
      std::is_trivially_copyable<long double>>' was not satisfied [with _To =
      _Uint_type, _From = long double]
_NODISCARD _CONSTEXPR_BIT_CAST _To _Bit_cast(const _From& _Val) noexcept {