Skip Menu |
 

This queue is for tickets about the Scalar-List-Utils CPAN distribution.

Report information
The Basics
Id: 102512
Status: open
Priority: 0/
Queue: Scalar-List-Utils

People
Owner: Nobody in particular
Requestors: stefan.tauner [...] technikum-wien.at
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: looks_like_number and scientific notation
Date: Wed, 4 Mar 2015 19:22:28 +0100
To: bug-Scalar-List-Utils [...] rt.cpan.org
From: Stefan Tauner <stefan.tauner [...] technikum-wien.at>
Download (untitled) / with headers
text/plain 753b
Hi, I tried to make sure what I see is in the current upstream source as well but I could not locate it fast enough... sorry. In my perl v5.18.2 installation (Ubuntu 14.04) it seems like looks_like_number requires at least one digit following the 'e' in scientific notation although perl "itself" does not: # perl -E 'use Scalar::Util "looks_like_number"; printf("%d - %d - %d\n", looks_like_number("13e"), looks_like_number("13e0"), "13e");' 0 - 1 - 13 kind regards, -- Dipl.-Ing. Stefan Tauner Research and Development Embedded Systems Department University of Applied Sciences Technikum Wien Hoechstaedtplatz 6, 1200 Vienna, Austria T: +43 1 333 40 77-316 E: stefan.tauner@technikum-wien.at I: embsys.technikum-wien.at I: www.technikum-wien.at
Download (untitled) / with headers
text/plain 1008b
On 2015-03-04 13:22:42, stefan.tauner@technikum-wien.at wrote: Show quoted text
> Hi, > > I tried to make sure what I see is in the current upstream source as > well but I could not locate it fast enough... sorry. > > In my perl v5.18.2 installation (Ubuntu 14.04) it seems like > looks_like_number requires at least one digit following the 'e' in > scientific notation although perl "itself" does not: > # perl -E 'use Scalar::Util "looks_like_number"; printf("%d - %d - > %d\n", looks_like_number("13e"), looks_like_number("13e0"), "13e");' > 0 - 1 - 13 > > kind regards,
Perl itself also requires a number after the "e": $ perl -E 'say 13e0' 13 $ perl -E 'say 13e' Bareword found where operator expected at -e line 1, near "13e" (Missing operator before e?) syntax error at -e line 1, near "13e " Execution of -e aborted due to compilation errors. Don't be confused by the different behavior of printf --- it ignores everything not looking like a digit: $ perl -E 'printf "%d\n", "13ghiurhgreiuhger"' 13


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.