Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Intel C++ Compiler 10.1 - long double type

Malgorzata_J_
Beginner
318 Views

Hello,

I have a very urgent problem to be solved. I use Windows XP operating system and Intel processors: Core 2 Duo 2,4, and Core 2 Duo Quad 2,4. I start using Intel C++ Compiler for Windows (installation file w_cc_p_10.1.021.exe) with Visual Studio 2008 and I have to use mailny 10 bytes long double data type in my computations. I have created "Win32 Console Application" and put the followingexample code to the cpp file:

// LongDoubleTest.cpp : Defines the entry point for the console application.

#include

"stdafx.h"

#include

int

main(int argc, char* argv[])

{

printf(" ");

printf("TEST ");

double d;

long double ld = 5;

d = 0.1;

ld = 5.1;

printf("%f %d ",d,sizeof(d));

printf(" THE END ");

_getch();

return 0;

}

I set compilation with Intel C++ compiler andadded the compiler options as follows: /Qlong_double /Qpc80.

Unfortunately, when I debug the program the long double type is unknown - we can see ??? in data type andld variable is set to 0. I have also a problem with the function printf. How can I use it for long double variables?

Please, answer my question as quick as possible because I need to make a very important project.

Malgorzata.

0 Kudos
2 Replies
TimP
Honored Contributor III
318 Views
Those are symptoms of the lack of support for 80-bit long double in Windows. You might debug with /Qlong_double removed.
In your example, ld = 5.1; the double constant 5.1 is not extended automatically to long double. You will not get much benefit from /Qlong_double unless you set contants to long double type.
0 Kudos
Andrey_C_Intel1
Employee
318 Views

Hello, Malgorzata.

AFAIK Microsoft tools do not support 80-bit or biggerfloatingdata. So you cannot print them in Microsoft debugger or using printf. You can only see this floating values in floatingregisters when they are loaded. To explicitelyprint 80-bit data you can convert them to 64-bit (in debugger or in printf),e.g. (double)some_long_double_variable. Alternatively you can examine the memory location of the data in HEX format in the debugger to see its binary representation.

- Andrey

0 Kudos
Reply