for equational laws to be sensible requires a sensible notion of equality, the Eq for Floating point numbers ismeant for handling corner cases (eg: am i about to divide by zero), not "semantic/denotational equivalence"Exact equality is fundamentally incorrect for finite precision mathematical computation.You typically want to have something likenearlyEq tolerance a b = if distance a b <= tolerance then True else FalseFloating point is geometry, not exact thingsis a package that provides an approx equality notion.Basically, floating points work the way they do because its a compromise that works decently for those who really need it.If you dont need to use floating point, dont! :)On Fri, Sep 26, 2014 at 9:28 AM, Jason Choy <jjwchoy@gmail.com> wrote:subject to certain caveats. It's not unfair to say that
floating point multiplication is (nearly) associative
"within a few ulp".I'm not disputing this.However, you can't deny that this monoid law is broken for the floating point operations:mappend x (mappend y z) = mappend (mappend x y) zPerhaps I'm being pedantic, but this law should hold for all x, y, z, and it clearly doesn't.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe