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;
}
/* end */
The people who discovered it first call this method
"Elimination by Quantification".
Its slightly blunt because it damages the precision of
extremely low but not yet denormal numbers: Anything
of magnitude < 2 ** -103 loses one bit of precision for
each binary order of magnitude it is below that number.
(This means that denormal numbers lose /all/ of their
precision and become zero).
There we go!!! That is an elegant solution.
Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo nospam(a)mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
"Republicans understand the importance of bondage between
mother and child." - George W. Bush
--
+-----------------------------------------------------------+
Erik de Castro Lopo nospam(a)mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
Everyone seems to assume that the current system in America is capitalism.
I beg to differ. True capitalism does not involve false advertising,
distribution cartels, or political lobbying for special advantages in the
market. How can you call Microsoft or the RIAA capitalist, when their main
business is interfering with a free market? Some of us would like to see a
*return* to capitalism in this country. - Jim Flynn on
Linuxtoday.com