develooper Front page | perl.perl6.language | Postings from July 2006

The exact value of infinity [Was: Re: sprintf and snake envy]

Thread Previous
From:
Dan Kogai
Date:
July 4, 2006 22:15
Subject:
The exact value of infinity [Was: Re: sprintf and snake envy]
Message ID:
77C501A8-2A30-4318-BB1E-45A80888A13B@dan.co.jp
On Jul 05, 2006, at 01:25 , Larry Wall wrote:
> What made me laugh is that Pugs knows the exact value of infinity:
>
>     pugs> my $a = {"$^lang has $^c.as('%03d') quote types."}(:c 
> (Inf),:lang<Perl>)
>     "Perl has  
> 1797693134862315907729305190789024733617976978942306572734300811577326 
> 7580550096313270847732240753602112011387987139335765878976881441662249 
> 2847430639474124377767893424865485276302219601246094119453082952085005 
> 7688381506823424628814739131105408272371633505106845862982399472459384 
> 79716304835356329624224137216 quote types."

Larry, you almost wrecked my MacBook Pro with the coffee I was  
sipping :)

I think I found the reason why Pugs knows the exact value of  
infinity.  That's GHC that tells pugs the exact value thereof.

This is Infinity according to Pugs.

./src/Pugs/AST/Internals.hs
>     doCast (VStr "Inf") = return $ 1/0

And this is what GHC thinks what Infinity is.

> Prelude> 2^1023 == 1/0
> False
> Prelude> 2^1024 == 1/0
> True

Dan the Pugs Walker


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About