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

Re: inf handling in Perl incomplete

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
August 4, 2001 07:58
Subject:
Re: inf handling in Perl incomplete
Message ID:
20010804095843.A16234@chaos.wustl.edu
On Sat, Aug 04, 2001 at 10:31:54AM +0200, Tels wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> 
> This is a bug report for perl from perl_dummy@bloodgate.com,
> generated with the help of perlbug 1.33 running under perl v5.7.2.
> 
> The inf (infinity) handling in Perl is, well, incomplete:

Incomplete is a kind way of putting it.  In reality there is
practically *NO* infinity handling.  I added just a couple of days ago
support for not saying "isn't numeric" for "Inf", and that pretty much
is the extent of our "Inf" support.  Someone would need to hack on
toke.c and sv.c to get e.g. the following things to work:

	$a = Inf;
	$b = Inf + 1;
	print Inf + 2;
	if ($c == Inf) { ... }
	print "foo\n" if Inf + Inf == Inf;

Whether 1000**1000 should:
	
	(1) silently return Inf
	(2) return Inf and warn under some lexical warning
	(3) return Inf and croak, must be eval { } catched

I don't know.
	
The various libcs can't decide whether to call it "Inf", "INF",
or "Infinity".

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
	print "spooky\n" if NaN == NaN; # should never print

	print "bar\n" if Inf - Inf == NaN;

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

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