develooper Front page | perl.perl5.porters | Postings from August 2001

Re: inf handling in Perl incomplete

Thread Previous | Thread Next
From:
Kurt D. Starsinic
Date:
August 9, 2001 07:19
Subject:
Re: inf handling in Perl incomplete
Message ID:
20010809071832.A12089@wolfetech.com
On Wed, Aug 08, 2001 at 08:58:55PM -0500, Jarkko Hietaniemi wrote:
> On Wed, Aug 08, 2001 at 03:18:39PM -0700, Kurt D. Starsinic wrote:
> > On Wed, Aug 08, 2001 at 11:26:42PM +0200, Tels wrote:
> > > On 08-Aug-01 Kurt D. Starsinic tried to scribble about:
> > > > On Wed, Aug 08, 2001 at 09:11:56AM +0100, Piers Cawley wrote:
> > > >> Jarkko Hietaniemi <jhi@iki.fi> writes:
> > > >> > While that someone is at it, "NaN" also needs fixing.  In there one
> > > >> > needs to move more carefully, since there usually are two kinds:
> > > >> > "signaling" and "quiet" NaNs.  The first kind gives SIGFPEs, the
> > > >> > second doesn't.
> > > >> > 
> > > >> >    $x = NaN;
> > > >> >    print "goofy\n" if 0/0 == NaN;  # should always print
> > 
> >     My reading of IEEE is that 0/0 is NaN, and semantically, NaN != NaN, so
> > the above should never print.
> 
> Ahhh, true.  Don't know what I was thinking.
> 
> >     I don't want to see bareword NaN and Inf upgrade automagically.  I think
> > it's more cruft, and there isn't just one NaN anyway.  I wouldn't mind a
> > pragma that made, e.g., 0/0 or sqrt(-1) return the appropriate NaN instead
> > of throwing an exception, though.
> 
> I am in the process of adding some more guts support for infinities
> and nans.  Well, I *was* in the process of doing that but then the
> fileserver where my working directory is, gave up the
> delivering-the-bits-business.
> 
> P.S.  Pssst, you certain you don't want sqrt(-1) returning 'i'? :-)

    You joke, but this is the logical extreme of the Magical Bearword
Numerics path:

    $x  = i;                        # sqrt(-1)
    $x  = UNICODE_FOR_ALEPH_NULL;   # Inf
    $x  = UNICODE_FOR_EPSILON;      # DBL_MIN

    Before you know it, we have native support for Conway numbers,
then we're APL.

    Bareword NaN should not become IEEE NaN.  QED.

    - Kurt


Thread Previous | Thread Next


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