This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/47146] Floating point to integer conversions


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47146

--- Comment #4 from Andreas Schwab <schwab@linux-m68k.org> 2011-01-03 17:40:24 UTC ---
> 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'.

Undefined behaviour: you pass a double value to a format that expects a value
of type int.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]