On 13 Jul 2007, at 2:58 am, apfelmus wrote:
What I wanted to do is to capture common patterns
x - y >= epsilon
abs (x - y) <= epsilon
for comparing floating point numbers in nice functions
x >> y = x - y >= epsilon
x ≈ y = abs (x - y) <= epsilon
See Knuth, The Art of Computer Programming,
Volume 2, Semi-Numerical algorithms,
for a suitable set of predicates and axioms they satisfy.
However, they depend on epsilon (or APL's []CT, comparison
tolerance). I once implemented the four predicates Knuth
discussed in Quintus Prolog (library(fuzzy)). As far as I
know, nobody ever used it. I had plans for making the
code faster if anybody cared, but no-one did.
I suspect these functions would be no more useful in
Haskell: anyone who knew enough to use them would know enough
not to.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe