[Haskell-cafe] Re: pi
Dan Weston
westondan at imageworks.com
Wed Oct 10 20:53:49 EDT 2007
David Benbennick wrote:
> On 10/10/07, Dan Weston <westondan at imageworks.com> wrote:
>> Actually, it is a constant: piDecimalExpansion :: String.
>
> Where is this constant defined?
>
>> 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.
>
> piDecimalExpansion, if defined, would be an infinite length string.
It would need to be added. The fact that it has infinite length is no
problem. It is countable infinite, and algorithms exist to compute this
lazily.
> The expression
>
> read $ "0." ++ repeat '1' :: Double
>
> is Bottom. So even if you had piDecimalExpansion, it isn't clear how
> to use that to define pi.
Ouch. Why is that bottom? Any finite dense numeric type can depend on
only a finite number of digits.
More information about the Haskell-Cafe
mailing list