On Wed, May 23, 2007 at 04:57:08PM -0500, Jack O'Quin wrote:
I know less about this than you do, Fons. But, I
always seem to end up
adding a rint() to statements like that. Not because I understand exactly
what is going on, but because otherwise GCC gives me warning messages
about casting float to int.
What happens, if you change those lines like this?...
y = (int) rint((x - a) * b + 0.5f);
Tried both floorf (x + 0.5f) which is my standard way of rounding
floats, and rint (x). Same results - the problem remains.
What is even more scary is this: adding a extra printf() _after_ all
the calculations and _after_ a number of other printf() that I have
been using to see what is happening is enough to remove the error -
it modifies the values printed by the previous printf()...
I'm now pretty sure this is the optimiser having an identity
crisis...
--
FA
Follie! Follie! Delirio vano รจ questo !