This is the mail archive of the
mailing list for the GCC project.
Re: Floating poing 'non-bug'? Or is this a bug?
In the case of:
i *= 1.2 ;
the compiler converts 1.2 to the nearst integer (1) and them multiples
by 1 and assigns that value to i.
No. Just like in the other case, i gets converted to a double,
multiplied, and converted to an integer. By pure luck in the
other case the temporary result (before conversion back to integer)
is a bit over 6.0; in this case, it obviously is smaller than 6.0 .
You might want to use a different rounding method than truncate-to-zero.