
On Thu, Apr 8, 2010 at 7:29 PM, Doug Burke
--- On Thu, 4/8/10, Gregory Crosswhite
wrote: From: Gregory Crosswhite
On a tangental note, I've considered coding up a package with an "AlmostEq" typeclass that allows one to test for approximate equality. The problem is that different situations call for different tolerances so there is no standard "approximate equal" operator that would work for everyone, but there might be a tolerance that is "good enough" for most situations where it would be needed (such as using QuickCheck to test that two different floating-point functions that are supposed to return the same answer actually do so) to make it worthwhile to have a standard package for this around for the sake of convenience.
Anyone have any thoughts on this?
I've always wondered if Haskell would make it easy to track number of significant digits. The other thought is that you could probably use Oleg's implicit configurations to handle the tolerance in a rather nice way: http://www.cs.rutgers.edu/~ccshan/prepose/prepose.pdf The example in the paper is managing the modulus implicitly and I would imagine the amount of precision could be managed similarly. Jason