On Thu, Jun 24, 2004 at 06:36:47 +1000, Erik de Castro
Lopo wrote:
On Thu, 24 Jun 2004 10:37:35 +0100
Simon Jenkins <sjenkins(a)blueyonder.co.uk> wrote:
inline float FlushToZero( volatile float f )
{
f += 9.8607615E-32f;
return f - 9.8607615E-32f;
}
There we go!!! That is an elegant solution.
Until the optimiser notices... but agreed its nicer. How much damage does
it do if you change one of the constant values slightly? The DC offset
would only occur at very low signals, so shouldn't affect feedback loops.
- Steve
That actually looks nice... since thanks to writing "volatile float f",
the optimizer should not touch it.. it' the same thing than
when one accsses directly to the harware using pointers
to memmaped registers.. lack of using "volatile" often
ends up in non-working code..
cheers!
reduz