[Bug c/47146] Floating point to integer conversions

schwab@linux-m68k.org gcc-bugzilla@gcc.gnu.org
Mon Jan 3 17:40:00 GMT 2011


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.



More information about the Gcc-bugs mailing list