develooper Front page | perl.perl5.porters | Postings from October 2018

Re: [perl #133582] POSIX::log2 weird behaviour

Thread Previous
From:
Tony Cook
Date:
October 13, 2018 04:02
Subject:
Re: [perl #133582] POSIX::log2 weird behaviour
Message ID:
20181013040213.yxl2pnn7fimsm2ut@mars.tony.develop-help.com
On Fri, Oct 12, 2018 at 07:10:52PM -0700, James E Keenan via RT wrote:
> On Fri, 12 Oct 2018 14:37:51 GMT, dpetrov@nes.ru wrote:
> > This is a bug report for perl from dpetrov@nes.ru,
> > generated with the help of perlbug 1.41 running under perl 5.28.0.
> > 
> > 
> > -----------------------------------------------------------------
> > perl -MPOSIX -e "print int POSIX::log2(64);"
> > 5
> > 
> > WTF?
> > 
> > -----------------------------------------------------------------
> > ---
> > Flags:
> >     category=library
> >     severity=high
> >     module=POSIX
> > ---
> > Site configuration information for perl 5.28.0:
> > 
> > Configured by strawberry-perl at Sat Jun 23 13:56:45 2018.
> > 
> > Summary of my perl5 (revision 5 version 28 subversion 0)
> > configuration:
> > 
> > Platform:
> >   osname=MSWin32
> >   osvers=10.0.17134.112
> >   archname=MSWin32-x64-multi-thread
> >   uname='Win32 strawberry-perl 5.28.0.1 #1 Sat Jun 23 13:55:45 2018
> > x64'
> >   config_args='undef'
> 
> Using perl-5.28.0 on Ubuntu Linux 18.04 LTS, I cannot reproduce your result:
> 
> #####
> $ perl -MPOSIX -e 'print POSIX::log2(64), "\n";'
> 6
> $ perl -MPOSIX -e 'print int POSIX::log2(64), "\n";'
> 6
> #####
> 
> Same results on FreeBSD-11.1.
> 
> Thank you very much.

It's floating point, the actual value on Win32 might be very close to
6 but just below it.

Tony

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About