[Haskell-cafe] Re: pi

Aaron Denney wnoise at ofb.net
Thu Oct 11 03:57:57 EDT 2007

On 2007-10-11, Jonathan Cast <jonathanccast at fastmail.fm> wrote:
> Yes.  I am very eager to criticize your wording.  To wit, I'm still
> failing to understand what your position is.  Is it fair to say that
> your answer to my question, why pi has no default implementation, is `in
> fact, pi shouldn't be a method of Floating anyway'?

That was how I was reading him.

> Btw: I am arguing that I (still) don't understand why the line
> pi = acos (-1)
> or something like it doesn't appear at an appropriate point in the
> Standard Prelude, given that the line
> pi :: a
> appears nearby said point.  I am eager to be enlightened.  But I haven't
> been, yet.

You would have to ask the committee.  But I think it's a bad idea to
have such a default (or 4 * atan 1, or ...) because of calculational
issues.  It's not a useful default, except for toy uses.  Yeah, it works
"fine" for float and double on hardware with FPUs.  But I want to be
told that I haven't implemented it, rather than it getting a really
awful default.  Most of the defaulting in other classes are minor
wrappers, such as converting between (<=) and compare, not actual
algorithmic implementations, which can pull in strongly less efficient

Aaron Denney

More information about the Haskell-Cafe mailing list