Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Can't take log of 0" error in perl 5.8.8. 64 bit #9338

Open
p5pRT opened this issue May 21, 2008 · 10 comments
Open

"Can't take log of 0" error in perl 5.8.8. 64 bit #9338

p5pRT opened this issue May 21, 2008 · 10 comments

Comments

@p5pRT
Copy link

p5pRT commented May 21, 2008

Migrated from rt.perl.org#54590 (status was 'open')

Searchable as RT54590$

@p5pRT
Copy link
Author

p5pRT commented May 21, 2008

From lourdes.pena@gmail.com

Hi,

If I run the following code in perl v5.8.8 built for
x86_64-linux-thread-multi, l get the error "Can't take log of 0 at - line
1."

perl
print log(2.5e-310)/log(10);
^D

But if I run it in perl v5.8.7 built for i486-linux-gnu-thread-multi, I get
the answer -309.602059991328.

Is this a known issue with perl 5.8.8. for 64bits? Thanks!

Here is the perl -V info​:

Summary of my perl5 (revision 5 version 8 subversion 8) configuration​:
  Platform​:
  osname=linux, osvers=2.6.9-55.0.9.elsmp,
archname=x86_64-linux-thread-multi
  uname='linux hs20-bc1-7.build.redhat.com 2.6.9-55.0.9.elsmp #1 smp tue
sep 25 02​:16​:15 edt 2007 x86_64 x86_64 x86_64 gnulinux '
  config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic
-Dversion=5.8.8 -Dmyhostname=localhost -Dperladmin=root@​localhost -Dcc=gcc
-Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr
-Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Dprivlib=/usr/lib/perl5/5.8.8
-Dsitelib=/usr/lib/perl5/site_perl/5.8.8
-Dvendorlib=/usr/lib/perl5/vendor_perl/5.8.8
-Darchlib=/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi
-Dsitearch=/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi
-Dvendorarch=/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi
-Darchname=x86_64-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib
-Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun
-Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio
-Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less
-isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto
-Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto
-Ud_setservent_r_proto -Dinc_version_list=5.8.7 5.8.6 5.8.5
-Dscriptdir=/usr/bin'
  hint=recommended, useposix=true, d_sigaction=define
  usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
  useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
  use64bitint=define use64bitall=define uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing
-pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
  optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic',
  cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe
-Wdeclaration-after-statement -I/usr/local/include -I/usr/include/gdbm'
  ccversion='', gccversion='4.1.1 20070105 (Red Hat 4.1.1-52)',
gccosandvers=''
  intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='gcc', ldflags =''
  libpth=/usr/local/lib64 /lib64 /usr/lib64
  libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
  perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
  libc=, so=so, useshrplib=true, libperl=libperl.so
  gnulibc_version='2.5'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E
-Wl,-rpath,/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE'
  cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic'

Characteristics of this binary (from libperl)​:
  Compile-time options​: MULTIPLICITY PERL_IMPLICIT_CONTEXT
  PERL_MALLOC_WRAP USE_64_BIT_ALL USE_64_BIT_INT
  USE_ITHREADS USE_LARGE_FILES USE_PERLIO
  USE_REENTRANT_API
  Built under linux
  Compiled at Oct 23 2007 12​:21​:53
  @​INC​:
  /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi
  /usr/lib64/perl5/site_perl/5.8.7/x86_64-linux-thread-multi
  /usr/lib64/perl5/site_perl/5.8.6/x86_64-linux-thread-multi
  /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi
  /usr/lib/perl5/site_perl/5.8.8
  /usr/lib/perl5/site_perl/5.8.7
  /usr/lib/perl5/site_perl/5.8.6
  /usr/lib/perl5/site_perl/5.8.5
  /usr/lib/perl5/site_perl
  /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi
  /usr/lib64/perl5/vendor_perl/5.8.7/x86_64-linux-thread-multi
  /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi
  /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi
  /usr/lib/perl5/vendor_perl/5.8.8
  /usr/lib/perl5/vendor_perl/5.8.7
  /usr/lib/perl5/vendor_perl/5.8.6
  /usr/lib/perl5/vendor_perl/5.8.5
  /usr/lib/perl5/vendor_perl
  /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi
  /usr/lib/perl5/5.8.8
  .

@p5pRT
Copy link
Author

p5pRT commented May 21, 2008

From @Tux

On Wed, 21 May 2008 10​:14​:48 -0700, "Lourdes Peña Castillo" (via RT)
<perlbug-followup@​perl.org> wrote​:

Hi,

If I run the following code in perl v5.8.8 built for
x86_64-linux-thread-multi, l get the error "Can't take log of 0 at - line
1."

perl
print log(2.5e-310)/log(10);
^D

I see the same for 5.10 on 32bit and 64bit

But if I run it in perl v5.8.7 built for i486-linux-gnu-thread-multi, I get
the answer -309.602059991328.

Is this a known issue with perl 5.8.8. for 64bits? Thanks!

Don't know if it is a known issue, but it is probably not (yet) fixed

--
H.Merijn Brand Amsterdam Perl Mongers (http​://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.10.x on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.1 & 10.2, AIX 5.2, and Cygwin. http​://qa.perl.org
http​://mirrors.develooper.com/hpux/ http​://www.test-smoke.org
  http​://www.goldmark.org/jeff/stupid-disclaimers/

@p5pRT
Copy link
Author

p5pRT commented May 21, 2008

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented May 22, 2008

From @Abigail

On Wed, May 21, 2008 at 10​:14​:48AM -0700, Lourdes Pe??a Castillo wrote​:

# New Ticket Created by "Lourdes Pe??a Castillo"
# Please include the string​: [perl #54590]
# in the subject line of all future correspondence about this issue.
# <URL​: http​://rt.perl.org/rt3/Ticket/Display.html?id=54590 >

Hi,

If I run the following code in perl v5.8.8 built for
x86_64-linux-thread-multi, l get the error "Can't take log of 0 at - line
1."

perl
print log(2.5e-310)/log(10);
^D

But if I run it in perl v5.8.7 built for i486-linux-gnu-thread-multi, I get
the answer -309.602059991328.

Is this a known issue with perl 5.8.8. for 64bits? Thanks!

I see a difference depending on whether Perl was build using 64 bit
integers or not, I get the error when running with 32 bit build, and
-309.602059991327962 when running with a 64 bit build. The version
(5.8.7, 5.8.8, 5.10.0) doesn't matter, nor does it matter whether it
was build with threads or not.

It seems that in a 32-bit build, 2.5e-310 gets constant folded to 0.

Abigail

@p5pRT
Copy link
Author

p5pRT commented May 22, 2008

From @Tux

On Thu, 22 May 2008 15​:27​:38 +0200, Abigail <abigail@​abigail.be> wrote​:

On Wed, May 21, 2008 at 10​:14​:48AM -0700, Lourdes Pe??a Castillo wrote​:

# New Ticket Created by "Lourdes Pe??a Castillo"
# Please include the string​: [perl #54590]
# in the subject line of all future correspondence about this issue.
# <URL​: http​://rt.perl.org/rt3/Ticket/Display.html?id=54590 >

Hi,

If I run the following code in perl v5.8.8 built for
x86_64-linux-thread-multi, l get the error "Can't take log of 0 at - line
1."

perl
print log(2.5e-310)/log(10);
^D

But if I run it in perl v5.8.7 built for i486-linux-gnu-thread-multi, I get
the answer -309.602059991328.

Is this a known issue with perl 5.8.8. for 64bits? Thanks!

I see a difference depending on whether Perl was build using 64 bit
integers or not, I get the error when running with 32 bit build, and
-309.602059991327962 when running with a 64 bit build. The version
(5.8.7, 5.8.8, 5.10.0) doesn't matter, nor does it matter whether it
was build with threads or not.

It seems that in a 32-bit build, 2.5e-310 gets constant folded to 0.

weird. both my perls were 64bitint. one of them 64bitall
that doesn't match your finding

--
H.Merijn Brand Amsterdam Perl Mongers (http​://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.10.x on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.1 & 10.2, AIX 5.2, and Cygwin. http​://qa.perl.org
http​://mirrors.develooper.com/hpux/ http​://www.test-smoke.org
  http​://www.goldmark.org/jeff/stupid-disclaimers/

@p5pRT
Copy link
Author

p5pRT commented May 22, 2008

From ben@morrow.me.uk

Quoth h.m.brand@​xs4all.nl ("H.Merijn Brand")​:

On Thu, 22 May 2008 15​:27​:38 +0200, Abigail <abigail@​abigail.be> wrote​:

On Wed, May 21, 2008 at 10​:14​:48AM -0700, Lourdes Pe??a Castillo wrote​:

# New Ticket Created by "Lourdes Pe??a Castillo"
# Please include the string​: [perl #54590]
# in the subject line of all future correspondence about this issue.
# <URL​: http​://rt.perl.org/rt3/Ticket/Display.html?id=54590 >

Hi,

If I run the following code in perl v5.8.8 built for
x86_64-linux-thread-multi, l get the error "Can't take log of 0 at - line
1."

perl
print log(2.5e-310)/log(10);
^D

But if I run it in perl v5.8.7 built for i486-linux-gnu-thread-multi, I get
the answer -309.602059991328.

Is this a known issue with perl 5.8.8. for 64bits? Thanks!

I see a difference depending on whether Perl was build using 64 bit
integers or not, I get the error when running with 32 bit build, and
-309.602059991327962 when running with a 64 bit build. The version
(5.8.7, 5.8.8, 5.10.0) doesn't matter, nor does it matter whether it
was build with threads or not.

It seems that in a 32-bit build, 2.5e-310 gets constant folded to 0.

weird. both my perls were 64bitint. one of them 64bitall
that doesn't match your finding

On i386-freebsd, with both 5.8 and 5.10, I seem to consistently get the
error with DEBUGGING perls and the correct answer with non-DEBUGGING
perls, regardless of 64bitint.

Ben

--
Musica Dei donum optimi, trahit homines, trahit deos. |
Musica truces mollit animos, tristesque mentes erigit. | ben@​morrow.me.uk
Musica vel ipsas arbores et horridas movet feras. |

@p5pRT
Copy link
Author

p5pRT commented May 22, 2008

From tchrist@perl.com

Scripsit hodie, XI Kalendas Iunias MMDCCLXI AUC, circa horam quartam
mediamque post meridiem (tempus Romae), Abigail <abigail@​abigail.be>​:

On Wed, May 21, 2008 at 10​:14​:48AM -0700, Lourdes Peña Castillo wrote​:

# New Ticket Created by "Lourdes Peña Castillo"
# Please include the string​: [perl #54590]
# in the subject line of all future correspondence about this issue.
# <URL​: http​://rt.perl.org/rt3/Ticket/Display.html?id=3D54590 >

Hi,

If I run the following code in perl v5.8.8 built for x86_64-linux-
thread-multi, I get the error "Can't take log of 0 at - line 1."

perl
print log(2.5e-310)/log(10);

But if I run it in perl v5.8.7 built for i486-linux-gnu-thread-multi,
I get

Is this a known issue with perl 5.8.8. for 64bits? Thanks!

[... now enter Abigail ...]

I see a difference depending on whether Perl was build using 64 bit
integers or not, I get the error when running with 32 bit build, and
-309.602059991327962 when running with a 64 bit build. The version
(5.8.7, 5.8.8, 5.10.0) doesn't matter, nor does it matter whether it
was built with threads or not.

It seems that in a 32-bit build, 2.5e-310 gets constant folded to 0.

Abigail and Lourdes,

I get slightly mixed results depending on version, configuration, and
platform (software+hardware). Here're the five different boxes and the
respective perl versions I tested under each box. Amongst perl5 tests,
I see the log 0 failure occurring uniquely on the last of these alone​:

  Box vperl details

  A v5.8.8 cygwin-thread-multi-64int

  B v5.6.0 i686-linux-thread
  v5.10.0 i686-linux-thread-multi-64int

  C 5.005_02 OpenBSD.i386-openbsd
  5.005_03 OpenBSD.i386-openbsd
  5.005_54 OpenBSD.i386-openbsd
  v5.6.0 OpenBSD.i386-openbsd-thread
  v5.8.7 OpenBSD.i386-openbsd
  v5.10.0 0penBSD.i386-openbsd-thread-multi-64int

  D v5.8.8 OpenBSD.i386-openbsd
  v5.10.0 OpenBSD.i386-openbsd

  E v5.6.0 OpenBSD.sparc-openbsd
  v5.10.0 OpenBSD.sparc-openbsd <- Can't take log of 0

On all of these EXCEPT FOR THE VERY LAST-MOST ENTRY ALONE,
I universally get

  -309.602059991328

Although admittedly when on machine C, I run

  boxC% perl1 -e 'print log(2.5e-310)/log(10), "\n";'
  -309.60205999132796251

or

  boxC% perl4.036 -e 'print log(2.5e-310)/log(10), "\n";'
  -309.60205999132796251

I do get more digits. But they're there anyway, since

  boxC% perl5.10.0 -e 'printf "%.45f\n", log ( 2.5e-310 ) /log ( 10 ) '
  -309.602059991327962507057236507534980773925781250

No, the different response of not being able to take the log of 0 occurs
only on that fifth machine, the sparc, *but* it occurs only with 5.10.0,
*not* 5.6.0--and, somewhat curiously, it is a run-time exception, too​:

  boxE% perl5.6.0 -le 'print log ( 2.5e-310 ) /log( 10 ) '
  -309.60205999132796251

  boxE% perl5.10.0 -le 'print log ( 2.5e-310 ) /log( 10 ) '
  Can't take log of 0 at -e line 1.
  Exit 255

  boxE% perl5.10.0 -cw -le 'print log ( 2.5e-310 ) /log( 10 ) '
  -e syntax OK

Whereas in older Perl, it was usually a compile-time error.

We can use 1/0 to show that this was always the case until
the lastmost release; that is, up until 5.10.0.

Although I see that it runs just fine under original perl,
(ie, perl1) which had the curious behaviour of producing
an Inf--and exiting 0! (O *how* I do so *love* venerably
retrotesting code with perl1! :-)

  boxC% perl1 -e 'print 1/0, "\n";'
  Inf

But later than that, we get an exception during compilation
due to constant-folding​:

  boxC% perl4.036 -cw -le 'print 1/0'
  Illegal division by constant zero in file /tmp/perl-eY11150 at line 2, next char ;
  /tmp/perl-eY11150 had compilation errors.
  Exit 2

  boxC% perl5.00503 -cw -le 'print 1/0'
  Illegal division by zero at -e line 1.
  Exit 255

  boxC% perl5.8.7 -cw -le 'print 1/0'
  Illegal division by zero at -e line 1.
  Exit 255

Yet today, this is different--depending. Whatever happened to
constant-folding at compile-time? Oh right! No exceptions there
any longer; I'd forgotten that particular delta entry.

  boxC% perl5.10.0 -cw -le 'print 1/0'
  -e syntax OK

  boxC% perl5.10.0 -le 'print 1/0'
  Illegal division by zero at -e line 1.
  Exit 19

Curious range of exit status, though, eh? 19? Why 19?

That seems to make no sense as a sysexit, a signo, nor
an errno--yet I should presume it but a malinging errno,
though; wouldn't you?

It's certainly not a sysexit per sysexit.h at all (they're >64),
which, rather lamentably, nobody much uses. See <sysexit.h>​:

  EX_OK EX_CANTCREAT EX_CONFIG EX_DATAERR EX_IOERR EX_NOHOST
  EX_NOINPUT EX_NOPERM EX_NOUSER EX_OSERR EX_OSFILE EX_PROTOCOL
  EX_SOFTWARE EX_TEMPFAIL EX_UNAVAILABLE EX_USAGE

Now, if it were 128..255, that then I thiknk would be a signal in
the high byte. And signal 19 is SIGCONT, the now-unused SIGFPE,
only 8. But it's not, so I think it an errno. Don't you?

Digging through docs on die() to figure out what happened suggests
die() seems to have taken some errno that was just sitting around
and used that. But errno 19 is ENODEV.

The CRT (=libc startup) often leaves this value lying about, perhaps
from a failed isatty(3). *But* when it leaves the errno lying about,
*you* end up lying about what was lying about; that is, about what
really occurrred, so to speak. :-)

Now I ask you, is this behaviour all of​: reasonable and expected,
understandable and predictable, *and* desirable?

FTR, my own current answer to that question happens to be "hmm".

--tom

@p5pRT
Copy link
Author

p5pRT commented May 23, 2008

From @demerphq

2008/5/22 Tom Christiansen <tchrist@​perl.com>​:

Scripsit hodie, XI Kalendas Iunias MMDCCLXI AUC, circa horam quartam
mediamque post meridiem (tempus Romae), Abigail <abigail@​abigail.be>​:

On Wed, May 21, 2008 at 10​:14​:48AM -0700, Lourdes Peña Castillo wrote​:

# New Ticket Created by "Lourdes Peña Castillo"
# Please include the string​: [perl #54590]
# in the subject line of all future correspondence about this issue.
# <URL​: http​://rt.perl.org/rt3/Ticket/Display.html?id=3D54590 >

Hi,

If I run the following code in perl v5.8.8 built for x86_64-linux-
thread-multi, I get the error "Can't take log of 0 at - line 1."

perl
print log(2.5e-310)/log(10);

But if I run it in perl v5.8.7 built for i486-linux-gnu-thread-multi,
I get

Is this a known issue with perl 5.8.8. for 64bits? Thanks!

[... now enter Abigail ...]

I see a difference depending on whether Perl was build using 64 bit
integers or not, I get the error when running with 32 bit build, and
-309.602059991327962 when running with a 64 bit build. The version
(5.8.7, 5.8.8, 5.10.0) doesn't matter, nor does it matter whether it
was built with threads or not.

It seems that in a 32-bit build, 2.5e-310 gets constant folded to 0.

Abigail and Lourdes,

I get slightly mixed results depending on version, configuration, and
platform (software+hardware). Here're the five different boxes and the
respective perl versions I tested under each box. Amongst perl5 tests,
I see the log 0 failure occurring uniquely on the last of these alone​:

Box vperl details

A v5.8.8 cygwin-thread-multi-64int

B v5.6.0 i686-linux-thread
v5.10.0 i686-linux-thread-multi-64int

C 5.005_02 OpenBSD.i386-openbsd
5.005_03 OpenBSD.i386-openbsd
5.005_54 OpenBSD.i386-openbsd
v5.6.0 OpenBSD.i386-openbsd-thread
v5.8.7 OpenBSD.i386-openbsd
v5.10.0 0penBSD.i386-openbsd-thread-multi-64int

D v5.8.8 OpenBSD.i386-openbsd
v5.10.0 OpenBSD.i386-openbsd

E v5.6.0 OpenBSD.sparc-openbsd
v5.10.0 OpenBSD.sparc-openbsd <- Can't take log of 0

On all of these EXCEPT FOR THE VERY LAST-MOST ENTRY ALONE,
I universally get

-309.602059991328

Although admittedly when on machine C, I run

boxC% perl1 -e 'print log(2.5e-310)/log(10), "\n";'
-309.60205999132796251

or

boxC% perl4.036 -e 'print log(2.5e-310)/log(10), "\n";'
-309.60205999132796251

I do get more digits. But they're there anyway, since

boxC% perl5.10.0 -e 'printf "%.45f\n", log ( 2.5e-310 ) /log ( 10 ) '
-309.602059991327962507057236507534980773925781250

No, the different response of not being able to take the log of 0 occurs
only on that fifth machine, the sparc, *but* it occurs only with 5.10.0,
*not* 5.6.0--and, somewhat curiously, it is a run-time exception, too​:

boxE% perl5.6.0 -le 'print log ( 2.5e-310 ) /log( 10 ) '
-309.60205999132796251

boxE% perl5.10.0 -le 'print log ( 2.5e-310 ) /log( 10 ) '
Can't take log of 0 at -e line 1.
Exit 255

boxE% perl5.10.0 -cw -le 'print log ( 2.5e-310 ) /log( 10 ) '
-e syntax OK

Whereas in older Perl, it was usually a compile-time error.

We can use 1/0 to show that this was always the case until
the lastmost release; that is, up until 5.10.0.

Although I see that it runs just fine under original perl,
(ie, perl1) which had the curious behaviour of producing
an Inf--and exiting 0! (O *how* I do so *love* venerably
retrotesting code with perl1! :-)

boxC% perl1 -e 'print 1/0, "\n";'
Inf

But later than that, we get an exception during compilation
due to constant-folding​:

boxC% perl4.036 -cw -le 'print 1/0'
Illegal division by constant zero in file /tmp/perl-eY11150 at line 2, next char ;
/tmp/perl-eY11150 had compilation errors.
Exit 2

boxC% perl5.00503 -cw -le 'print 1/0'
Illegal division by zero at -e line 1.
Exit 255

boxC% perl5.8.7 -cw -le 'print 1/0'
Illegal division by zero at -e line 1.
Exit 255

Yet today, this is different--depending. Whatever happened to
constant-folding at compile-time? Oh right! No exceptions there
any longer; I'd forgotten that particular delta entry.

boxC% perl5.10.0 -cw -le 'print 1/0'
-e syntax OK

boxC% perl5.10.0 -le 'print 1/0'
Illegal division by zero at -e line 1.
Exit 19

Curious range of exit status, though, eh? 19? Why 19?

That seems to make no sense as a sysexit, a signo, nor
an errno--yet I should presume it but a malinging errno,
though; wouldn't you?

It's certainly not a sysexit per sysexit.h at all (they're >64),
which, rather lamentably, nobody much uses. See <sysexit.h>​:

EX_OK EX_CANTCREAT EX_CONFIG EX_DATAERR EX_IOERR EX_NOHOST
EX_NOINPUT EX_NOPERM EX_NOUSER EX_OSERR EX_OSFILE EX_PROTOCOL
EX_SOFTWARE EX_TEMPFAIL EX_UNAVAILABLE EX_USAGE

Now, if it were 128..255, that then I thiknk would be a signal in
the high byte. And signal 19 is SIGCONT, the now-unused SIGFPE,
only 8. But it's not, so I think it an errno. Don't you?

Digging through docs on die() to figure out what happened suggests
die() seems to have taken some errno that was just sitting around
and used that. But errno 19 is ENODEV.

The CRT (=libc startup) often leaves this value lying about, perhaps
from a failed isatty(3). *But* when it leaves the errno lying about,
*you* end up lying about what was lying about; that is, about what
really occurrred, so to speak. :-)

Does this mean that we should clear this value at some point during our startup?

Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"

@p5pRT
Copy link
Author

p5pRT commented Sep 20, 2010

From @cpansprout

On Wed May 21 10​:14​:46 2008, lourdes.pena@​gmail.com wrote​:

Hi,

If I run the following code in perl v5.8.8 built for
x86_64-linux-thread-multi, l get the error "Can't take log of 0 at - line
1."

perl
print log(2.5e-310)/log(10);
^D

But if I run it in perl v5.8.7 built for i486-linux-gnu-thread-multi,
I get
the answer -309.602059991328.

If I use strtod (on Mac OS X), I get the correct result, regardless of
perl version​:

#!perl -l
use POSIX 'strtod';
print log(strtod '2.5e-310')/log(10);

It prints​:
-309.602059991328

So, I expect this is related to bug 41202.

@p5pRT
Copy link
Author

p5pRT commented Sep 20, 2010

From [Unknown Contact. See original ticket]

On Wed May 21 10​:14​:46 2008, lourdes.pena@​gmail.com wrote​:

Hi,

If I run the following code in perl v5.8.8 built for
x86_64-linux-thread-multi, l get the error "Can't take log of 0 at - line
1."

perl
print log(2.5e-310)/log(10);
^D

But if I run it in perl v5.8.7 built for i486-linux-gnu-thread-multi,
I get
the answer -309.602059991328.

If I use strtod (on Mac OS X), I get the correct result, regardless of
perl version​:

#!perl -l
use POSIX 'strtod';
print log(strtod '2.5e-310')/log(10);

It prints​:
-309.602059991328

So, I expect this is related to bug 41202.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants