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

inconsistent text to float conversion #10370

Closed
p5pRT opened this issue May 10, 2010 · 7 comments
Closed

inconsistent text to float conversion #10370

p5pRT opened this issue May 10, 2010 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented May 10, 2010

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

Searchable as RT75016$

@p5pRT
Copy link
Author

p5pRT commented May 10, 2010

From jmitchell@frb.gov

This is a bug report for perl from jmitchell@​frb.gov,
generated with the help of perlbug 1.35 running under perl v5.8.8.

#!/opt/local/bin/perl

use strict;
use warnings;

# these do not become identical floating point numbers
my @​tests = (
  14151.155,
  1.4151155E4,
  );

for my $test (@​tests) {
  printf "%.30g\n", $test;
}

# this might be a false lead, but for some reason, they are identical
# after stringification
for my $test (@​tests) {
  printf "%.30g\n", $test . '';
}

# output on 5.8.8 and 5.10.0
# 14151.155000000001
# 14151.154999999999
# 14151.155000000001
# 14151.155000000001

# output on 5.8.5 (i.e. this problem hasn't always existed)​:
# 14151.155000000001
# 14151.155000000001
# 14151.155000000001
# 14151.155000000001


Flags​:
  category=core
  severity=medium


Site configuration information for perl v5.8.8​:

Configured by appadm at Mon Apr 27 10​:32​:55 EDT 2009.

Summary of my perl5 (revision 5 version 8 subversion 8) configuration​:
  Platform​:
  osname=linux, osvers=2.6.18-92.1.18.el5xen, archname=x86_64-linux-thread-multi
  uname='linux jhbdev.rsma.frb.gov 2.6.18-92.1.18.el5xen #1 smp wed nov 5 09​:15​:48 est 2008 x86_64 x86_64 x86_64 gnulinux '
  config_args='-des -Dprefix=/opt/perl -Duseshrplib -Dusethreads -Accflags=-DPERL_REENTRANT_MAXSIZE=65536'
  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='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DPERL_REENTRANT_MAXSIZE=65536 -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -I/opt/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
  optimize='-O2',
  cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DPERL_REENTRANT_MAXSIZE=65536 -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -I/opt/local/include -I/usr/include/gdbm'
  ccversion='', gccversion='4.1.2 20071124 (Red Hat 4.1.2-42)', 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='cc', ldflags =' -L/usr/local/lib -L/opt/local/lib'
  libpth=/usr/local/lib /opt/local/lib /lib /usr/lib
  libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
  perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
  libc=/lib/libc-2.5.so, 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,/opt/perl/lib/5.8.8/x86_64-linux-thread-multi/CORE'
  cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib -L/opt/local/lib'

Locally applied patches​:
 


@​INC for perl v5.8.8​:
  /opt/perl/lib/5.8.8/x86_64-linux-thread-multi
  /opt/perl/lib/5.8.8
  /opt/perl/lib/site_perl/5.8.8/x86_64-linux-thread-multi
  /opt/perl/lib/site_perl/5.8.8
  /opt/perl/lib/site_perl
  .


Environment for perl v5.8.8​:
  HOME=/eim/home/m1jhm01
  LANG=en_US
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/eim/lib​:/opt/local/bin​:/usr/kerberos/bin​:/usr/local/bin​:/bin​:/usr/bin​:/usr/X11R6/bin
  PERL_BADLANG (unset)
  SHELL=/bin/tcsh

@p5pRT
Copy link
Author

p5pRT commented May 11, 2010

From zefram@fysh.org

Jeff Mitchell wrote​:

# these do not become identical floating point numbers
my @​tests = (
14151.155,
1.4151155E4,
);

This resembles [perl #41202]. We have a duff text->float conversion.

-zefram

@p5pRT
Copy link
Author

p5pRT commented May 11, 2010

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

@p5pRT
Copy link
Author

p5pRT commented May 11, 2010

From jmitchell@frb.gov

On Tue May 11 07​:46​:42 2010, zefram@​fysh.org wrote​:

This resembles [perl #41202]. We have a duff text->float conversion.

-zefram

I agree, and noticed that bug as well. However, it might be worth
noting that I could replicate the bug in 41202 on 5.8.5 whereas this bug
did not exist in 5.8.5.

@p5pRT
Copy link
Author

p5pRT commented Feb 3, 2013

From @jkeenan

On Tue May 11 08​:56​:15 2010, jhm713 wrote​:

On Tue May 11 07​:46​:42 2010, zefram@​fysh.org wrote​:

This resembles [perl #41202]. We have a duff text->float conversion.

-zefram

I agree, and noticed that bug as well. However, it might be worth
noting that I could replicate the bug in 41202 on 5.8.5 whereas this bug
did not exist in 5.8.5.

Persists in 5.16.0. See attached.

@p5pRT
Copy link
Author

p5pRT commented Feb 3, 2013

From @jkeenan

75016_float.pl

@khwilliamson
Copy link
Contributor

This is now fixed in blead. Presumably it is from the same fix as #8730

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

3 participants