develooper Front page | perl.perl5.porters | Postings from November 2000

Re: [PATCH] Re: pp_add -> pp_i_add efficiency hack?

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
November 25, 2000 16:13
Subject:
Re: [PATCH] Re: pp_add -> pp_i_add efficiency hack?
Message ID:
20001125181321.A5098@chaos.wustl.edu
> --- sv.c.orig	Wed Nov 22 23:58:27 2000
> +++ sv.c	Sat Nov 25 22:34:57 2000
> @@ -2010,6 +2010,7 @@
>  	    s++; if (*s != 'I' && *s != 'i') return 0;
>  	    s++; if (*s != 'T' && *s != 't') return 0;
>  	    s++; if (*s != 'Y' && *s != 'y') return 0;
> +	    s++;
>  	}
>  	sawinf = 1;
>      }

Oops.  I think I tested only with 'Inf'...

> Anyway, glibc seems to like NaN and infinity:

As I said: that Perl passes 'nan' without complaining isn't a guarantee
that the libc will.  Before somebody suggests that Configure can test
libc/atof on nan/inf, I say that no, it can't, easily at least.  These
corners of libc/libm/<math.h> are very nonstandardized: in other words,
a horrible mess.

> nick@Bagpuss [bleadperl]$ perl  -wle 'print "nan" * 0'
> Argument "nan" isn't numeric in multiplication (*) at -e line 1.
> nan
> nick@Bagpuss [bleadperl]$ perl  -wle 'print "control" * 0'
> Argument "control" isn't numeric in multiplication (*) at -e line 1.
> 0
> 
> FreeBSD doesn't:
> 
> bash-2.02$ perl  -wle 'print "nan" * 0'
> Argument "nan" isn't numeric in multiply at -e line 1.
> 0
> bash-2.02$ ./perl  -wle 'print "inf" + 1'
> 1
> bash-2.02$ ./perl  -wle 'print "infinity" + 1'
> 1
> 
> 
> Nicholas Clark

-- 
$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