At Mon, 17 Oct 2011 11:41:38 -0700, Ian Lance Taylor wrote: > > Momchil Ivanov <momchil@xxxxxxx> writes: > > >> In gcc 4.5 and up -std=c99 implies -fexcess-precision=standard, q.v. > > > > Thank you for the tip, but I still don't understand why the following produces different output for both floats when compiled with -fexcess-precision=standard: > > > > #include <stdio.h> > > > > int > > main(int argc, char *argv[]) > > { > > float a = 268517138.f; > > printf(" 268517138.f = %f\t%f\n", 268517138.f, a); > > > > return 0; > > } > > > > output with -fexcess-precision=standard: > > 268517138.f = 268517138.000000 268517152.000000 > > output without -fexcess-precision=standard: > > 268517138.f = 268517152.000000 268517152.000000 > > Good point. I think it is a bug that the values differ when using > -fexcess-precision=standard. There is an implicit cast to double when > calling printf; the problem may be that that cast is not being applied > to the properly rounded value. > > Please open a bug report as per http://gcc.gnu.org/bugs . Thanks. > > Ian bug report filed: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50773