develooper Front page | perl.perl5.porters | Postings from May 2010

[perl #75016] inconsistent text to float conversion

Thread Next
From:
Jeff Mitchell
Date:
May 11, 2010 07:21
Subject:
[perl #75016] inconsistent text to float conversion
Message ID:
rt-3.6.HEAD-4976-1273523717-256.75016-75-0@perl.org
# New Ticket Created by  Jeff Mitchell 
# Please include the string:  [perl #75016]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=75016 >



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


Thread Next


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