Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 12/16/2022
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

macOS:

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 run time.

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$ 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.

test1.cpp
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)