[Haskell-cafe] Re: pi
westondan at imageworks.com
Wed Oct 10 20:34:43 EDT 2007
Actually, it is a constant: piDecimalExpansion :: String.
A translation from piDecimalExpansion :: String to pi :: Floating a => a
is already well defined via read :: Read a => String -> a
Any definition of pi in the Floating class that differs from (read
piDecimalExpansion) is erroneous. I propose the above as the default
definition of pi.
> Someone wrote about pi:
> | But it is just a numerical constant, no need to put it into a class, and
>>> nothing to do with the type_classing of related functions. "e" is not
>>> std. defined, and it doesn't kill people who use exponentials.
> But it *isn't* "A" numerical constant.
> It is a *different* constant for each instance of Floating.
> In this respect, it's not unlike floatRange, which is just "a"
> constant (a pair of integers), but is different for each
> RealFloat instance.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe