[Haskell-cafe] pi

Dan Piponi dpiponi at gmail.com
Wed Oct 10 11:49:56 EDT 2007

Jules Bean said:
> If it is true of many Floating instances that (atan 1 * 4) is an
> accurate way to calculate pi (and it appears to be 'accurate enough' for
> Float and Double, on my computer) then adding it as a default doesn't
> appear to do any harm.

Maybe this is the wrong point of view, but I think of defaults as
impementations that are meant to be correct, but not necessarily the
best way of doing things, leaving you the option to provide something
better. For the case of power series as an instance of Num, using
4*atan 1 gives me the wrong thing as it triggers an infinite
summation, whereas I'd want pi to simply equal the constant power
series. Now you could counter that by saying that power series are an
esoteric case. But apart from code in the libraries, most code I've
seen that provides an instance of Num is doing something mildly

More information about the Haskell-Cafe mailing list