[Haskell-beginners] Double's

Felipe Lessa felipe.lessa at gmail.com
Wed Jul 22 08:23:26 EDT 2009


On Tue, Jul 21, 2009 at 10:45:29PM -0400, Brent Yorgey wrote:
> On Tue, Jul 21, 2009 at 08:51:05PM -0300, Felipe Lessa wrote:
> > Note that Rational's are really really really slow, probably it
>
> Premature optimization is the sqrt of all evil.

I agree, however statistics tend to be very math intensive, and
even in simple cases you may end up with a big numerator and a
big denominator, totally thrashing your performance.  He could
write all his functions as taking a (Num a), which would let him
choose between both, but if he wants to do that then he must
learn how to handle the subtleties of Doubles.

(Also Rationals don't support a lot of useful functions like
sqrt itself or exp.)

--
Felipe.


More information about the Beginners mailing list