Skip Menu |
Report information
Id: 127183
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: dankogai <dankogai [at] dan.co.jp>
Cc:
AdminCc:

Operating System: darwin
PatchStatus: (no value)
Severity: medium
Type: core
Perl Version: 5.22.1
Fixed In: (no value)



From: Dan Kogai <dankogai [...] dan.co.jp>
To: perlbug [...] perl.org
Subject: Non-canonical hexadecimal floats are parsed prematurely
Date: Wed, 6 Jan 2016 20:56:28 +0900
Download (untitled) / with headers
text/plain 4.1k
This is a bug report for perl from dankogai@dan-imac151.local, generated with the help of perlbug 1.40 running under perl 5.22.1. ----------------------------------------------------------------- [Please describe your issue here] I am so glad Perl 5.22 adds support to the C99 hexadecimal floating point notation. What I am not so glad is I found that perl sometimes parses hex floats prematurely. % perl -E 'say sprintf "%a", 0x0.b17217f7d1cf78p0 - 0x1.62e42fefa39efp-1' -0x1p-53 As you see, LHS is non-normal form and RHS normal. AFAIK in other platforms that support hexfloats 0x0.b17217f7d1cf78p0 == 0x1.62e42fefa39efp-1: C: http://ideone.com/Q0kbTL C++: http://ideone.com/j3odtE Ruby: http://ideone.com/VPj3Ie Swift: http://swiftlang.ng.bluemix.net/#/repl/2e2ccb20e8e262f8f54dc7e8af7fda9511f526198c1e71584bd17029616c3cf6 Dan the Bit-Picking Perl Monger [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=medium --- Site configuration information for perl 5.22.1: Configured by dankogai at Thu Dec 17 00:32:07 JST 2015. Summary of my perl5 (revision 5 version 22 subversion 1) configuration: Platform: osname=darwin, osvers=15.2.0, archname=darwin-thread-multi-2level uname='darwin dan-imac151.local 15.2.0 darwin kernel version 15.2.0: fri nov 13 19:56:56 pst 2015; root:xnu-3248.20.55~2release_x86_64 x86_64 ' config_args='-DDEBUGGING -Doptimize=-g -pipe -Os -Accflags=-DPERL_USE_SAFE_PUTENV -Duseshplib -Dusethreads -Dusemultiplicity -Duse64bitall -des' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-common -DPERL_DARWIN -arch x86_64 -DPERL_USE_SAFE_PUTENV -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/opt/local/include', optimize='-g -pipe -Os', cppflags='-arch x86_64 -fno-common -DPERL_DARWIN -arch x86_64 -DPERL_USE_SAFE_PUTENV -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/opt/local/include' ccversion='', gccversion='4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc -arch x86_64', ldflags =' -arch x86_64 -fstack-protector-strong -L/usr/local/lib -L/opt/local/lib' libpth=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /usr/lib /usr/local/lib /opt/local/lib libs=-lpthread -lgdbm -ldbm -ldl -lm -lutil -lc perllibs=-lpthread -ldl -lm -lutil -lc libc=, so=dylib, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib -fstack-protector-strong' --- @INC for perl 5.22.1: /usr/local/lib/perl5/site_perl/5.22.1/darwin-thread-multi-2level /usr/local/lib/perl5/site_perl/5.22.1 /usr/local/lib/perl5/5.22.1/darwin-thread-multi-2level /usr/local/lib/perl5/5.22.1 /usr/local/lib/perl5/site_perl/5.22.0/darwin-thread-multi-2level /usr/local/lib/perl5/site_perl/5.22.0 /usr/local/lib/perl5/site_perl . --- Environment for perl 5.22.1: DYLD_LIBRARY_PATH (unset) HOME=/Users/dankogai LANG=en_US.UTF-8 LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/Users/dankogai/sbin:/Users/dankogai/bin:/Users/dankogai/.rakudobrew/bin:/Users/dankogai/node_modules/.bin:/usr/local/bin:/opt/local/sbin:/opt/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PERL_BADLANG (unset) SHELL=/bin/tcsh
Download signature.asc
application/pgp-signature 495b

Message body not shown because it is not plain text.

To: <perl5-porters [...] perl.org>, <bugs-bitbucket [...] rt.perl.org>
Subject: Re: [perl #127183] Non-canonical hexadecimal floats are parsed prematurely
From: <sisyphus1 [...] optusnet.com.au>
Date: Thu, 7 Jan 2016 13:42:01 +1100
Download (untitled) / with headers
text/plain 602b
Show quoted text
-----Original Message----- From: Dan Kogai (via RT) Sent: Wednesday, January 06, 2016 10:57 PM To: bugs-bitbucket@rt.perl.org Subject: [perl #127183] Non-canonical hexadecimal floats are parsed prematurely
> This is a bug report for perl from dankogai@dan-imac151.local, > generated with the help of perlbug 1.40 running under perl 5.22.1.
> % perl -E 'say sprintf "%a", 0x0.b17217f7d1cf78p0 - > 0x1.62e42fefa39efp-1' > -0x1p-53
Works fine for me on MS Windows, perl-5.22.0: C:\>perl -E "say sprintf '%a', 0x0.b17217f7d1cf78p0 - 0x1.62e42fefa39efp-1" 0x0p+0 A regression ? Cheers, Rob
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 179b
If you can, please test the bleadperl at http://perl5.git.perl.org/perl.git/commit/eba98284740b799def26803ebac340aaa8930437 Test the hexfp literals and the %a without mercy.
Subject: Re: [perl #127183] Non-canonical hexadecimal floats are parsed prematurely
CC: perl5-porters [...] perl.org, bugs-bitbucket [...] rt.perl.org
Date: Fri, 25 Mar 2016 16:14:29 +0000
To: sisyphus1 [...] optusnet.com.au
From: Dave Mitchell <davem [...] iabyn.com>
Download (untitled) / with headers
text/plain 1.1k
On Thu, Jan 07, 2016 at 01:42:01PM +1100, sisyphus1@optusnet.com.au wrote: Show quoted text
> -----Original Message----- From: Dan Kogai (via RT) > Sent: Wednesday, January 06, 2016 10:57 PM > To: bugs-bitbucket@rt.perl.org > Subject: [perl #127183] Non-canonical hexadecimal floats are parsed > prematurely >
> >This is a bug report for perl from dankogai@dan-imac151.local, > >generated with the help of perlbug 1.40 running under perl 5.22.1.
>
> > % perl -E 'say sprintf "%a", 0x0.b17217f7d1cf78p0 - > >0x1.62e42fefa39efp-1' > > -0x1p-53
> > Works fine for me on MS Windows, perl-5.22.0: > > C:\>perl -E "say sprintf '%a', 0x0.b17217f7d1cf78p0 - 0x1.62e42fefa39efp-1" > 0x0p+0 > > A regression ?
the maint-5.22 branch now prints 0x0p+0, as well as perl-5.23.0 onwards. So I think this ticket can be closed. -- "But Sidley Park is already a picture, and a most amiable picture too. The slopes are green and gentle. The trees are companionably grouped at intervals that show them to advantage. The rill is a serpentine ribbon unwound from the lake peaceably contained by meadows on which the right amount of sheep are tastefully arranged." -- Lady Croom, "Arcadia"


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

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org