[MLton-user] timing anomoly
Sean McLaughlin
seanmcl at gmail.com
Thu Dec 6 06:57:32 PST 2007
>From Goldberg: What every computer scientist should know about
floating point arithmetic:
"The importance of preserving parentheses cannot be
overemphasized. The algorithms presented in theorems 3, 4 and 6 all depend
on it. For example, in Theorem 6, the formula xh = mx - (mx - x) would reduce
to xh = x if it weren't for parentheses, thereby destroying the entire
algorithm.
A language definition that does not require parentheses to be honored is
useless for floating-point calculations."
On Dec 5, 2007 4:55 PM, Florian Weimer <fw at deneb.enyo.de> wrote:
> * Matthew Fluet:
>
> > FP arithemetic is not associative, so it is not really justified (or
> > at least numerically accurate) to reassociate the computation for
> > constant folding. I could see constant folding the idividual
> > negations and multiplications, but the additions really ought not be.
>
> In this case, the folding GCC performs increases accuracy, which is
> permitted according to the floating point model implement by GCC (and,
> presumably, what's described in the relevant appendix of C99). Without
> -ffast-math, GCC is supposed to not apply any transformation which
> reduces accuracy.
>
More information about the MLton-user
mailing list