Faster, GHC, and floating point.
ajb at spamcop.net
ajb at spamcop.net
Thu Oct 16 21:25:01 EDT 2003
G'day all.
Quoting JP Bernardy <jyp_7 at yahoo.com>:
> 1. Use -fexcess-precision, unless you really need the
> exact (lesser) precision. Otherwise each intermediate
> result is spilled in memory. This hurts!
Yes, but it does avoid incorrect numerics, which hurts fewer times, but
when it does, it hurts a LOT more. :-)
Using C, you can often get code like this:
float x;
if ((x = some_complex_expression()) < 0)
{
assert(x < 0); /* This assert can fail. */
}
The reason is that x has 80 bits of precision when the first test is
performed, but by the time you get to the second one, it has been
truncated to 32 bits and is now == 0.
Cheers,
Andrew Bromage
More information about the Glasgow-haskell-users
mailing list