On 5/23/07, Fons Adriaensen <fons@xxxxxxxxxxxxxxx> wrote:
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...
Arrgh! Put it in a separate function to defeat the optimizer? -- joq _______________________________________________ Linux-audio-user mailing list Linux-audio-user@xxxxxxxxxxxxxxxxxxxx http://lists.linuxaudio.org/mailman/listinfo.cgi/linux-audio-user