This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/39034] New: Decimal floating-point math done wrong
- From: "tydeman at tybor dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Jan 2009 01:22:41 -0000
- Subject: [Bug c/39034] New: Decimal floating-point math done wrong
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Using gcc 4.3.2-7 on Intel Pentium 4 running Fedora Core 10 with -std=gnu99 of
/* DFP TR 24732 == WG14 / N1176, N1312 */
#define __STDC_WANT_DEC_FP__ /* Tell implementation that we want Decimal FP */
#include <stdio.h> /* printf() */
int main(void){
double d2 = (double)((28./3.-9.) - (31./3.-10.));
_Decimal64 d10 = (double)((28./3.-9.) - (31./3.-10.));
if( d2 ){
printf("d2 should be zero\n");
}
if( d10 ){
printf("d10 should be zero\n");
}
return 0;
}
gets:
d10 should be zero
This should be independent of Translation Time Data Type (TTDT)
which has been dropped from the DFP TR as of WG14 N1312.
--
Summary: Decimal floating-point math done wrong
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tydeman at tybor dot com
GCC host triplet: 4.3.2
GCC target triplet: 4.3.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39034