[Bug c/39034] New: Decimal floating-point math done wrong

tydeman at tybor dot com gcc-bugzilla@gcc.gnu.org
Fri Jan 30 01:22:00 GMT 2009


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



More information about the Gcc-bugs mailing list