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

Intel 64 mode: _Decimal32 multiply and divide are bad

tydeman
Beginner
306 Views
Hardware: Centrino 2 vPro (Core2Duo) in 64-bit mode
O.S.: Linux Fedora Core 10 in 64-bit mode
Compiler: Intel icc 11.1, 072 in Intel64 mode
Command line options: "-msse3 -O0 -fp-model strict -fp-speculation=strict -H ${INCS}"

Results: bad 3 and bad 4 => multiply and divide of decimal floating point done wrong.

Program:

#define __STDC_WANT_DEC_FP__ 1 /* Tell compiler we want DFP */

#include

int main(void){
int j;
_Decimal32 x,y;

x = 1.0000000DF;
for(j=1; j<=3; j++){
y = x + 10.000000DF;
if( y == x ) (void)printf("Bad1\\n");
x = y;
}

x = 1.0000000DF;
for(j=1; j<=3; j++){
y = x - 10.000000DF;
if( y == x ) (void)printf("Bad2\\n");
x = y;
}

x = 1.0000000DF;
for(j=1; j<=3; j++){
y = x * 10.000000DF;
if( y == x ) (void)printf("Bad3\\n");
x = y;
}

x = 1.0000000DF;
for(j=1; j<=3; j++){
y = x / 10.000000DF;
if( y == x ) (void)printf("Bad4\\n");
x = y;
}

return 0;
}

0 Kudos
2 Replies
Milind_Kulkarni__Int
New Contributor II
306 Views
Thanks for raising the issue. I have escalated this issue to the developer team. The gcc from 4.3.x and later give the correct result, i.e, no "Bad" output. While, icc give the Bad3 & Bad4 output.

There seem to be quite many issues with Decimal data types. One of the recent is here:--

http://software.intel.com/en-us/forums/showthread.php?t=75875
0 Kudos
Milind_Kulkarni__Int
New Contributor II
306 Views
This issue has been resolved in 12.1 compilers.
Closing the issue now.
0 Kudos
Reply