- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page