[Haskell-cafe] floating-point comparison (was haskell gsoc proposal for richer numerical type classes and supporting algorithms)

Jason Dagit dagit at codersbase.com
Sun Apr 11 19:41:29 EDT 2010


On Thu, Apr 8, 2010 at 7:29 PM, Doug Burke <doug_j_burke at yahoo.com> wrote:

>
> --- On Thu, 4/8/10, Gregory Crosswhite <gcross at phys.washington.edu> wrote:
>
> > From: Gregory Crosswhite <gcross at phys.washington.edu>
>
> >
> > 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100411/452cee61/attachment.html


More information about the Haskell-Cafe mailing list