Incompatibility between Visual C++ and Intel C++ regarding the long double type

Incompatibility between Visual C++ and Intel C++ regarding the long double type


I integrated the Intel C++ Compiler XE 2013 into Microsoft Visual Studio Professional Edition 2008 in order to be able to use long double data types with 80bit precision.

I used the /Qlong-double flag during compilation, and disabled all the optimizations available in Intel C++.

The program compiles and links without errors. However I observed that long double still doesn't work correctly.

When I print the following:

cout<<std::numeric_limits<long double>::digits10<<endl;
cout<<std::numeric_limits<long double>::epsilon()<<endl;
cout<<sizeof(long double)<<endl;

I get the following output:


-0 -->why??? 





Moreover, when I debug my code, I see that the types of my long double variables are unknown i.e. it shows ??? as the type instead of "long double". And when I set long double aa = 1.0; long double bb = 1e-18; the value of aa and bb are set to 0 and 2461398656 respectively. 

Can anyone help me with the problem? 

Thank you,


11 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

"compatibllity" includes the use of Microsoft headers and libraries. This is documented in the description of /Qlong-double. The operand has to be cast implicitly to double for cout. I assume you use the debugging facility provided by Microsoft which also has no provision for a long double differing from double.

Does Intel C++ compiler have its own runtime library? I installed the Intel C++ compiler, but found out that most of the headers and libraries are absent. On Windows it is dependent on MSVC's header files and libraries I suppose. How can I use Intel's own C/C++ library?
Thank you,

As far as I know, the Intel-supplied libraries are intended to be additions, not replacements, to the MS-supplied C libraries. The exception may be a small number of functions for which ICL supplies higher-performance versions.

Hi Meriko,

>>...On Windows it is dependent on MSVC's header files and libraries...

Please use MS Depends to verify which CRT-libraries are used. I'd like to refer you to an Intel manual:

Intel® 64 and IA-32 Architectures Software Developer's Manual Volume 1: Basic Architecture

in order to get more technical information regarding a 'long double' data type.

My personal recommendation is 'Do Not Use' 'long double' type and 'Use' 'double' type instead. However, I'll take a look at your test-case.

Best regards,

>>cout [left-arrow-left-arrow] sizeof(long double) [left-arrow-left-arrow] endl;

How did you get a value 16?

It has to be 10 for Intel & Microsoft C++ compilers, and 12 for MinGW C++ compiler.

sizeof doesn't tell how many bits are actually used in the data type. It tells how many storage bytes are consumed. In a 64-bit OS, 80-bit long double normally is stored on 16-byte boundaries for improved performance. Of course, it still will not compete with performance of 32- or 64-bit SSE or AVX data types. 32-bit gcc normally uses 12-byte boundaries, so icc ia32 would do the same.
If your preference for x87 code is specific to 32-bit mode, that's understandable, but you should still consider portability factors, or specify when your advice is specific to 32-bit "ia32" or "387" mode.

Is Intel Compiler stand alone compiler with its own CRT libraries? Can I install Intel C++ compiler on Windows without having MCVS or Visual C++?
Thank you,

MSVCRT run-time library does not support a long double primitive type.The only support for this type is for compatibility reason.For example
MSVCRT implementation of library printf will cast long double to double before printing to stdout its value.

You cannot by-pass Windows Msvcrt.dll runtime libraries without the drastically changing Windows infrastructure(I mean runtime libraries).Every program compiled on Win platform is dynamicaly linked with CRT-libraries.You can change compiler linking behaviour by hooking at runtime calls to
CRT-functions and providing your own implementation.

>>...Can I install Intel C++ compiler on Windows without having MCVS or Visual C++?

I think Yes, but I'll need MS linker and CRT import libraries ( to build binaries ), and MS CRT DLLs ( to execute binaries ) from a Platform SDK.

In a case when VS is not installed an installer should display a warning message.

Leave a Comment

Please sign in to add a comment. Not a member? Join today