Bug#725449: perl-doc: underspecified semantics of numbers and numeric operations

Vincent Lefevre vincent at vinc17.net
Sat Oct 5 23:48:55 UTC 2013


Package: perl-doc
Version: 5.18.1-4
Severity: normal

[Reported in perl-doc, but there could also be bugs in perl itself.]

The semantics of numbers and numeric operations seems to be specified
in the perlnumber(1) man page, but various operations are not specified
at all and seem to be inconsistent, maybe buggy. For instance,

$ perl -e 'printf "%f\n", 0./0.'
Illegal division by zero at -e line 1.

$ perl -e 'printf "%f\n", 1./0.'
Illegal division by zero at -e line 1.

Why an error and not NaN (resp. Inf), as per IEEE 754 rules?

Note that Perl seems to have Inf and NaN support, hence the above
question:

$ perl -e 'printf "%f\n", exp(1000)'
inf

$ perl -e 'printf "%f\n", exp(1000)-exp(1000)'
-nan

Why does one get the following?

$ perl -e 'printf "%f\n", "0x12"'
0.000000

0x12, if not interpreted as a hex number, should probably regarded as
an invalid numeric value, thus it should give NaN or an error (like
the operation 0./0.).

FYI:

$ /usr/bin/printf "%f\n" 0x12
18.000000

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.10-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages perl-doc depends on:
ii  perl  5.18.1-4

perl-doc recommends no packages.

Versions of packages perl-doc suggests:
ii  groff                 1.22.2-3
ii  man-db [man-browser]  2.6.5-2

-- no debconf information




More information about the Perl-maintainers mailing list