http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47146
--- Comment #6 from Pierre Innocent <babelart at yahoo dot com> 2011-01-06 03:17:01 UTC --- Daer Kargl, Thanks, my mistake ! The C99 tests failures may be due to non-athlon specific code. Still checking ! Regards, Pierre Innocent --- On Mon, 1/3/11, sgk at troutmask dot apl.washington.edu <gcc-bugzi...@gcc.gnu.org> wrote: > From: sgk at troutmask dot apl.washington.edu <gcc-bugzi...@gcc.gnu.org> > Subject: [Bug c/47146] Floating point to integer conversions > To: babel...@yahoo.com > Received: Monday, January 3, 2011, 1:01 PM > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47146 > > --- Comment #5 from Steve Kargl <sgk at troutmask dot > apl.washington.edu> 2011-01-03 18:01:11 UTC --- > On Mon, Jan 03, 2011 at 05:12:10PM +0000, babelart at yahoo > dot com wrote: > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47146 > > > > Sorry, I was not specific enough. It is the integer > conversion that seem > > to be wrong,for example the following two lines: > > > > fprintf( stdout, "Float 100.0 * 0.3894949=%d\n", 100.0 > * elapsed ); > > fprintf( stdout, "Float 100 * 0.3894949=%d\n", 100 * > elapsed ); > > > > both produce the value '-536870912'. > > > > I also downloaded the C99 integer to float conversion > test code; and they > > generated two many failures. I also believe the > compiler should round resulting > > integer values when stripping decimals off. > > > > Regards, > > Pierre Innocent > > > > Compile the code with -Wall and fix all the warnings. > > #include <stdio.h> > int > main (void) > { > float elapsed; > elapsed = 0.3894949; /* Note, the > rhs is a double! */ > printf("Float 100.0 * 0.3894949=%d\n", > 100.0 * elapsed ); > printf("Float 100 * 0.3894949=%d\n", 100 > * elapsed ); > return 0; > } > > troutmask:kargl[208] cc -o z -Wall a.c > a.c: In function 'main': > a.c:7: warning: format '%d' expects type 'int', but > argument 2 has type > 'double' > a.c:8: warning: format '%d' expects type 'int', but > argument 2 has type > 'double' > > Your printf statements are using the first 4 bytes of > the 8 byte double argument. > > -- > Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email > ------- You are receiving this mail because: ------- > You reported the bug. >