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

numeric.c assumes that NV_DIG+2 will be enough digits for all precision possible in NV #7586

Closed
p5pRT opened this issue Nov 9, 2004 · 14 comments
Closed

Comments

@p5pRT
Copy link

@p5pRT p5pRT commented Nov 9, 2004

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

Searchable as RT32380$

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Nov 9, 2004

From allens@cpan.org

Created by allens@cpan.org

It would be greatly appreciated, BTW, if perlbug did not assume that the
running version of perl on a system was the same one being reported on and/or
would not assume that the version of perl it was set up for is the one
installed on a system (wrong perl location, libraries, etcetera for testing).
It would also be nice if it allowed a category of 'patch'. I would not describe
this as being generated with the _help_ of perlbug...

numeric.c, in the Perl_my_atof2 function, makes the following assumption​:

/* There is no point in processing more significant digits
* than the NV can hold. Note that NV_DIG is a lower-bound value,
* while we need an upper-bound value. We add 2 to account for this;
* since it will have been conservative on both the first and last digit.
* For example a 32-bit mantissa with an exponent of 4 would have
* exact values in the set
* 4
* 8
* ..
* 17179869172
* 17179869176
* 17179869180
*
* where for the purposes of calculating NV_DIG we would have to discount
* both the first and last digit, since neither can hold all values from
* 0..9; but for calculating the value we must examine those two digits.
*/
#define MAX_SIG_DIGITS (NV_DIG+2)

Digits beyond MAX_SIG_DIGITS are ignored. In some systems and/or modes
(e.g., with/without using long doubles), this is not the case. One
example is IRIX when using long doubles, which are not fully IEEE
compliant; with it, while NV_DIG (the _minimum_ number of digits
usable) is 31 for long doubles used as NVs, long doubles can have up
to 34 digits of accuracy. (As well as IRIX with long doubles, other
machines using a mode in which NV is not IEEE compliant (e.g., as
found by the following from numeric.c​:

#ifdef ((defined(VMS) && !defined(__IEEE_FP)) || defined(_UNICOS))

(although UNICOS does not by default use Perl's atof in any event) or
as noted in the hints files for DEC OSF with the old MIPS CC) may
benefit from a change to this.) I will attach a test program, example
set of problematic outputs, and experimental patch so others can
explore this on their systems. (With the patch and a
-Accflags='-DMAX_SIG_DIG_PLUS=3' (or
-Accflags='-DMAX_SIG_DIG_PLUS=4'), the test program was
successful. Different values of MAX_SIG_DIG_PLUS may need to be
experimented with, especially with different other Configure/compiler
flags (long doubles yes/no, optimization affecting floating point,
etcetera); 3 was the maximum that did any good on IRIX with long
doubles, but others may differ.) I have done some local testing (as in
the normal testsuite) of the patch and different -DMAX_SIG_DIG_PLUS
values, and will be doing more; it is possible that it would be best
to build in the test program into, say, numconvert.t. Patching
hints/irix_6.sh to use -DMAX_SIG_DIG_PLUS=3 if long doubles are in
use, or a define of MAX_SIG_DIG_PLUS to 3 if defined(IRIX) and long
doubles are in use, is also advisable; I have not included either in my patch
because I was unsure which was recommended practice.

  -Allen

Perl Info

Flags:
    category=patch
    severity=medium

Site configuration information for perl v5.9.2:

Configured by easmith at Tue Nov  9 06:14:17 EST 2004.

Summary of my perl5 (revision 5 version 9 subversion 2 patch 23485) configuration:
  Platform:
    osname=irix, osvers=6.5, archname=IP27-irix-thread-multi-64int-ld
    uname='irix64 dogberry 6.5 04091957 ip27 '
    config_args='-des -Dusedevel -DDEBUGGING -Duseperlio -Dusethreads -Duseithreads -Dnoextensions=Encode I18N/Langinfo -Accflags=-mips4 -DDEBUGGING -Dusemorebits -A define:optimize=-O3 -OPT:space=OFF:Olimit=0'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define useithreads=define usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=define use64bitall=undef uselongdouble=define
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc -n32', ccflags ='-mips4 -DPTHREAD_H_FIRST -D_BSD_TYPES -D_BSD_TIME -woff 1184,1552 -DHAS_LDBL_SPRINTF_BUG -DLANGUAGE_C',
    optimize='-O3 -OPT:space=OFF:Olimit=0',
    cppflags='-DHAS_LDBL_SPRINTF_BUG -mips4 -DPTHREAD_H_FIRST -D_BSD_TYPES -D_BSD_TIME -DHAS_LDBL_SPRINTF_BUG -DLANGUAGE_C'
    ccversion='MIPSpro Compilers: Version 7.3.1.3m', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=87654321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long long', ivsize=8, nvtype='long double', nvsize=16, Off_t='off_t', lseeksize=8
    alignbytes=16, prototype=define
  Linker and Libraries:
    ld='cc -n32', ldflags =' -Wl,-woff,84 -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib32 /lib32 /lib /usr/lib
    libs=-ldb -lm -lpthread
    perllibs=-lm -lpthread
    libc=/usr/lib32/libc.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-n32 -shared -L/usr/local/lib'

Locally applied patches:
    DEVEL22511


@INC for perl v5.9.2:
    /usr/local/lib/perl5/5.9.2/IP27-irix-thread-multi-64int-ld
    /usr/local/lib/perl5/5.9.2
    /usr/local/lib/perl5/site_perl/5.9.2/IP27-irix-thread-multi-64int-ld
    /usr/local/lib/perl5/site_perl/5.9.2
    /usr/local/lib/perl5/site_perl
    .


Environment for perl v5.9.2:
    HOME=/
    LANG=en_US
    LANGUAGE (unset)
    LD_LIBRARYN32_PATH (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/share/sbin:/usr/local/sbin:/server/people/staff/easmith/compiled:/usr/sbin:/usr/bsd:/sbin:/usr/bin:/bin:/usr/lib:/usr/etc:/etc:/usr/Cadmin/bin:/usr/bin/X11:/usr/gfx:/usr/lib/Zmail/bin:/server/people/staff/easmith/perl/prog:/usr/share/bin
    PERL_BADLANG (unset)
    SHELL=/bin/csh

Complete configuration data for perl v5.9.2:

Author=''
CONFIG='true'
Date='$Date'
Header=''
Id='$Id'
Locker=''
Log='$Log'
Mcc='Mcc'
PATCHLEVEL='9'
PERL_API_REVISION='5'
PERL_API_SUBVERSION='1'
PERL_API_VERSION='9'
PERL_CONFIG_SH='true'
PERL_PATCHLEVEL='23485'
PERL_REVISION='5'
PERL_SUBVERSION='2'
PERL_VERSION='9'
RCSfile='$RCSfile'
Revision='$Revision'
SUBVERSION='2'
Source=''
State=''
_a='.a'
_exe=''
_o='.o'
afs='false'
afsroot='/afs'
alignbytes='16'
ansi2knr=''
aphostname='/usr/bsd/hostname'
api_revision='5'
api_subversion='1'
api_version='9'
api_versionstring='5.9.1'
ar='ar'
archlib='/usr/local/lib/perl5/5.9.2/IP27-irix-thread-multi-64int-ld'
archlibexp='/usr/local/lib/perl5/5.9.2/IP27-irix-thread-multi-64int-ld'
archname='IP27-irix-thread-multi-64int-ld'
archname64='64int'
archobjs=''
asctime_r_proto='REENTRANT_PROTO_B_SB'
awk='awk'
baserev='5.0'
bash=''
bin='/usr/local/bin'
binexp='/usr/local/bin'
bison='bison'
byacc='byacc'
byteorder='87654321'
c='\c'
castflags='0'
cat='cat'
cc='cc -n32'
cccdlflags=' '
ccdlflags=' '
ccflags='-mips4 -DPTHREAD_H_FIRST -D_BSD_TYPES -D_BSD_TIME -woff 1184,1552 -DHAS_LDBL_SPRINTF_BUG -DLANGUAGE_C'
ccflags_uselargefiles=''
ccname='cc -n32'
ccsymbols='LANGUAGE_C=1 MIPSEB=1 _ABIN32=2 _COMPILER_VERSION=730 _LANGUAGE_C=1 _LONGLONG=1 _MIPSEB=1 _MIPS_FPSET=32 _MIPS_ISA=4 _MIPS_SIM=_ABIN32 _MIPS_SZINT=32 _MIPS_SZLONG=32 _MIPS_SZPTR=32 _MODERN_C=1 _PIC=1 _SGI_SOURCE=1 _SIZE_INT=32 _SIZE_LONG=32 _SIZE_PTR=32 _SVR4_SOURCE=1 _SYSTYPE_SVR4=1 __DSO__=1 __EXTENSIONS__=1 __host_mips=1 __INLINE_INTRINSICS=1 __mips=4 __MATH_HAS_NO_SIDE_EFFECTS=1 __sgi=1'
ccversion='MIPSpro Compilers: Version 7.3.1.3m'
cf_by='easmith'
cf_email='easmith@dogberry.rutgers.edu'
cf_time='Tue Nov  9 06:14:17 EST 2004'
charsize='1'
chgrp=''
chmod='chmod'
chown=''
clocktype='clock_t'
comm='comm'
compress=''
config_arg0='./Configure'
config_arg1='-des'
config_arg10='-Dusemorebits'
config_arg11='-A'
config_arg12='define:optimize=-O3 -OPT:space=OFF:Olimit=0'
config_arg2='-Dusedevel'
config_arg3='-DDEBUGGING'
config_arg4='-Duseperlio'
config_arg5='-Dusethreads'
config_arg6='-Duseithreads'
config_arg7='-Dnoextensions=Encode I18N/Langinfo'
config_arg8='-Accflags=-mips4'
config_arg9='-DDEBUGGING'
config_argc='12'
config_args='-des -Dusedevel -DDEBUGGING -Duseperlio -Dusethreads -Duseithreads -Dnoextensions=Encode I18N/Langinfo -Accflags=-mips4 -DDEBUGGING -Dusemorebits -A define:optimize=-O3 -OPT:space=OFF:Olimit=0'
contains='grep'
cp='cp'
cpio=''
cpp='cpp'
cpp_stuff='42'
cppccsymbols='host_mips=1 mips=1 sgi=1 unix=1 __unix=1'
cppflags='-DHAS_LDBL_SPRINTF_BUG -mips4 -DPTHREAD_H_FIRST -D_BSD_TYPES -D_BSD_TIME -DHAS_LDBL_SPRINTF_BUG -DLANGUAGE_C'
cpplast=''
cppminus=''
cpprun='/usr/lib/cpp'
cppstdin='cppstdin'
cppsymbols='_BSD_TIME=1 _BSD_TYPES=1 _COMPILER_VERSION=730 __DSO__=1 __EXTENSIONS__=1 __host_mips=1 __INLINE_INTRINSICS=1 LANGUAGE_C=1 _LANGUAGE_C=1 _LONGLONG=1 __mips=4 __MATH_HAS_NO_SIDE_EFFECTS=1 MIPSEB=1 _MIPSEB=1 _MIPS_FPSET=32 _MIPS_ISA=4 _MIPS_SIM=2 _MIPS_SZINT=32 _MIPS_SZLONG=32 _MIPS_SZPTR=32 _MODERN_C=1 _PIC=1 __sgi=1 _SGI_SOURCE=1 _SIZE_INT=32 _SIZE_LONG=32 _SIZE_PTR=32 __STDC__=1 _SVR4_SOURCE=1 _SYSTYPE_SVR4=1'
crypt_r_proto='0'
cryptlib=''
csh='csh'
ctermid_r_proto='REENTRANT_PROTO_B_B'
ctime_r_proto='REENTRANT_PROTO_B_SB'
d_Gconvert='qgcvt((x),(n),(b))'
d_PRIEUldbl='define'
d_PRIFUldbl='define'
d_PRIGUldbl='define'
d_PRIXU64='define'
d_PRId64='define'
d_PRIeldbl='define'
d_PRIfldbl='define'
d_PRIgldbl='define'
d_PRIi64='define'
d_PRIo64='define'
d_PRIu64='define'
d_PRIx64='define'
d_SCNfldbl='define'
d__fwalk=''
d_access='define'
d_accessx=''
d_aintl=''
d_alarm='define'
d_archlib='define'
d_asctime_r='define'
d_atolf=''
d_atoll='define'
d_attribut=''
d_bcmp='define'
d_bcopy='define'
d_bsd='define'
d_bsdgetpgrp=''
d_bsdsetpgrp=''
d_bzero='define'
d_casti32='define'
d_castneg='define'
d_charvspr=''
d_chown='define'
d_chroot='define'
d_chsize=''
d_class=''
d_closedir='define'
d_cmsghdr_s='define'
d_const='define'
d_copysignl='define'
d_crypt='define'
d_crypt_r=''
d_csh='define'
d_ctermid_r='define'
d_ctime_r='define'
d_cuserid='define'
d_dbl_dig='define'
d_dbminitproto='define'
d_difftime='define'
d_dirfd=''
d_dirnamlen=''
d_dlerror='define'
d_dlopen='define'
d_dlsymun=''
d_dosuid=''
d_drand48_r=''
d_drand48proto='define'
d_dup2='define'
d_eaccess=''
d_endgrent='define'
d_endgrent_r=''
d_endhent='define'
d_endhostent_r=''
d_endnent='define'
d_endnetent_r=''
d_endpent='define'
d_endprotoent_r=''
d_endpwent='define'
d_endpwent_r=''
d_endsent='define'
d_endservent_r=''
d_eofnblk='define'
d_eunice=''
d_faststdio='define'
d_fchdir='define'
d_fchmod='define'
d_fchown='define'
d_fcntl='define'
d_fcntl_can_lock='define'
d_fd_macros='define'
d_fd_set='define'
d_fds_bits='define'
d_fgetpos='define'
d_finite='define'
d_finitel='define'
d_flexfnam='define'
d_flock='define'
d_flockproto='define'
d_fork='define'
d_fp_class=''
d_fpathconf='define'
d_fpclass='define'
d_fpclassify=''
d_fpclassl='define'
d_fpos64_t='define'
d_frexpl='define'
d_fs_data_s=''
d_fseeko='define'
d_fsetpos='define'
d_fstatfs='define'
d_fstatvfs='define'
d_fsync='define'
d_ftello='define'
d_ftime=''
d_getcwd='define'
d_getespwnam=''
d_getfsstat=''
d_getgrent='define'
d_getgrent_r='define'
d_getgrgid_r='define'
d_getgrnam_r='define'
d_getgrps='define'
d_gethbyaddr='define'
d_gethbyname='define'
d_gethent='define'
d_gethname='define'
d_gethostbyaddr_r='define'
d_gethostbyname_r='define'
d_gethostent_r='define'
d_gethostprotos='define'
d_getitimer='define'
d_getlogin='define'
d_getlogin_r='define'
d_getmnt=''
d_getmntent='define'
d_getnbyaddr='define'
d_getnbyname='define'
d_getnent='define'
d_getnetbyaddr_r='define'
d_getnetbyname_r='define'
d_getnetent_r='define'
d_getnetprotos='define'
d_getpagsz='define'
d_getpbyname='define'
d_getpbynumber='define'
d_getpent='define'
d_getpgid='define'
d_getpgrp='define'
d_getpgrp2=''
d_getppid='define'
d_getprior='define'
d_getprotobyname_r='define'
d_getprotobynumber_r='define'
d_getprotoent_r='define'
d_getprotoprotos='define'
d_getprpwnam=''
d_getpwent='define'
d_getpwent_r='define'
d_getpwnam_r='define'
d_getpwuid_r='define'
d_getsbyname='define'
d_getsbyport='define'
d_getsent='define'
d_getservbyname_r='define'
d_getservbyport_r='define'
d_getservent_r='define'
d_getservprotos='define'
d_getspnam='define'
d_getspnam_r='define'
d_gettimeod='define'
d_gmtime_r='define'
d_gnulibc=''
d_grpasswd='define'
d_hasmntopt='define'
d_htonl='define'
d_ilogbl='define'
d_index=''
d_inetaton='define'
d_int64_t='define'
d_isascii='define'
d_isfinite=''
d_isinf=''
d_isnan='define'
d_isnanl='define'
d_killpg='define'
d_lchown='define'
d_ldbl_dig='define'
d_link='define'
d_localtime_r='define'
d_locconv='define'
d_lockf='define'
d_longdbl='define'
d_longlong='define'
d_lseekproto='define'
d_lstat='define'
d_madvise='define'
d_mblen='define'
d_mbstowcs='define'
d_mbtowc='define'
d_memchr='define'
d_memcmp='define'
d_memcpy='define'
d_memmove='define'
d_memset='define'
d_mkdir='define'
d_mkdtemp=''
d_mkfifo='define'
d_mkstemp='define'
d_mkstemps=''
d_mktime='define'
d_mmap='define'
d_modfl='define'
d_modfl_pow32_bug=''
d_modflproto=''
d_mprotect='define'
d_msg='define'
d_msg_ctrunc='define'
d_msg_dontroute='define'
d_msg_oob='define'
d_msg_peek='define'
d_msg_proxy=''
d_msgctl='define'
d_msgget='define'
d_msghdr_s='define'
d_msgrcv='define'
d_msgsnd='define'
d_msync='define'
d_munmap='define'
d_mymalloc=''
d_nice='define'
d_nl_langinfo='define'
d_nv_preserves_uv='define'
d_off64_t='define'
d_old_pthread_create_joinable=''
d_oldpthreads=''
d_oldsock=''
d_open3='define'
d_pathconf='define'
d_pause='define'
d_perl_otherlibdirs=''
d_phostname=''
d_pipe='define'
d_poll='define'
d_portable='define'
d_procselfexe=''
d_pthread_atfork='define'
d_pthread_attr_setscope='define'
d_pthread_yield=''
d_pwage='define'
d_pwchange=''
d_pwclass=''
d_pwcomment='define'
d_pwexpire=''
d_pwgecos='define'
d_pwpasswd='define'
d_pwquota=''
d_qgcvt='define'
d_quad='define'
d_random_r=''
d_readdir='define'
d_readdir64_r='define'
d_readdir_r='define'
d_readlink='define'
d_readv='define'
d_recvmsg='define'
d_rename='define'
d_rewinddir='define'
d_rmdir='define'
d_safebcpy=''
d_safemcpy=''
d_sanemcmp='define'
d_sbrkproto='define'
d_scalbnl='define'
d_sched_yield='define'
d_scm_rights=''
d_seekdir='define'
d_select='define'
d_sem='define'
d_semctl='define'
d_semctl_semid_ds=''
d_semctl_semun='define'
d_semget='define'
d_semop='define'
d_sendmsg='define'
d_setegid='define'
d_seteuid='define'
d_setgrent='define'
d_setgrent_r=''
d_setgrps='define'
d_sethent='define'
d_sethostent_r=''
d_setitimer='define'
d_setlinebuf='define'
d_setlocale='define'
d_setlocale_r=''
d_setnent='define'
d_setnetent_r=''
d_setpent='define'
d_setpgid='define'
d_setpgrp='define'
d_setpgrp2=''
d_setprior='define'
d_setproctitle=''
d_setprotoent_r=''
d_setpwent='define'
d_setpwent_r=''
d_setregid='define'
d_setresgid=''
d_setresuid=''
d_setreuid='define'
d_setrgid='define'
d_setruid='define'
d_setsent='define'
d_setservent_r=''
d_setsid='define'
d_setvbuf='define'
d_sfio=''
d_shm='define'
d_shmat='define'
d_shmatprototype='define'
d_shmctl='define'
d_shmdt='define'
d_shmget='define'
d_sigaction='define'
d_sigprocmask='define'
d_sigsetjmp='define'
d_sockatmark=''
d_sockatmarkproto=''
d_socket='define'
d_socklen_t='define'
d_sockpair='define'
d_socks5_init=''
d_sqrtl='define'
d_srand48_r=''
d_srandom_r=''
d_sresgproto=''
d_sresuproto=''
d_statblks='define'
d_statfs_f_flags=''
d_statfs_s='define'
d_statvfs='define'
d_stdio_cnt_lval='define'
d_stdio_ptr_lval='define'
d_stdio_ptr_lval_nochange_cnt='define'
d_stdio_ptr_lval_sets_cnt=''
d_stdio_stream_array='define'
d_stdiobase='define'
d_stdstdio='define'
d_strchr='define'
d_strcoll='define'
d_strctcpy='define'
d_strerrm='strerror(e)'
d_strerror='define'
d_strerror_r=''
d_strftime='define'
d_strlcat=''
d_strlcpy=''
d_strtod='define'
d_strtol='define'
d_strtold='define'
d_strtoll='define'
d_strtoq=''
d_strtoul='define'
d_strtoull='define'
d_strtouq=''
d_strxfrm='define'
d_suidsafe=''
d_symlink='define'
d_syscall='define'
d_syscallproto=''
d_sysconf='define'
d_sysernlst=''
d_syserrlst='define'
d_system='define'
d_tcgetpgrp='define'
d_tcsetpgrp='define'
d_telldir='define'
d_telldirproto='define'
d_time='define'
d_times='define'
d_tm_tm_gmtoff=''
d_tm_tm_zone=''
d_tmpnam_r=''
d_truncate='define'
d_ttyname_r='define'
d_tzname='define'
d_u32align='define'
d_ualarm='define'
d_umask='define'
d_uname='define'
d_union_semun='define'
d_unordered='define'
d_usleep='define'
d_usleepproto='define'
d_ustat='define'
d_vendorarch=''
d_vendorbin=''
d_vendorlib=''
d_vendorscript=''
d_vfork=''
d_void_closedir=''
d_voidsig='define'
d_voidtty=''
d_volatile='define'
d_vprintf='define'
d_wait4=''
d_waitpid='define'
d_wcstombs='define'
d_wctomb='define'
d_writev='define'
d_xenix=''
date='date'
db_hashtype='u_int32_t'
db_prefixtype='size_t'
db_version_major='1'
db_version_minor='0'
db_version_patch='0'
defvoidused='15'
direntrytype='struct dirent'
dlext='so'
dlsrc='dl_dlopen.xs'
doublesize='8'
drand01='drand48()'
drand48_r_proto='0'
dynamic_ext='B ByteLoader Cwd DB_File Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Fcntl File/Glob Filter/Util/Call IO IPC/SysV List/Util MIME/Base64 NDBM_File ODBM_File Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Time/HiRes Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared'
eagain='EAGAIN'
ebcdic=''
echo='echo'
egrep='egrep'
emacs=''
endgrent_r_proto='0'
endhostent_r_proto='0'
endnetent_r_proto='0'
endprotoent_r_proto='0'
endpwent_r_proto='0'
endservent_r_proto='0'
eunicefix=':'
exe_ext=''
expr='expr'
extensions='B ByteLoader Cwd DB_File Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Fcntl File/Glob Filter/Util/Call IO IPC/SysV List/Util MIME/Base64 NDBM_File ODBM_File Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Time/HiRes Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared Errno'
extras=''
fflushNULL='define'
fflushall=''
find=''
firstmakefile='makefile'
flex=''
fpossize='8'
fpostype='fpos_t'
freetype='void'
from=':'
full_ar='/usr/bin/ar'
full_csh='/sbin/csh'
full_sed='/sbin/sed'
gccansipedantic=''
gccosandvers=''
gccversion=''
getgrent_r_proto='REENTRANT_PROTO_S_SBW'
getgrgid_r_proto='REENTRANT_PROTO_I_TSBWR'
getgrnam_r_proto='REENTRANT_PROTO_I_CSBWR'
gethostbyaddr_r_proto='REENTRANT_PROTO_S_TWISBIE'
gethostbyname_r_proto='REENTRANT_PROTO_S_CSBIE'
gethostent_r_proto='REENTRANT_PROTO_S_SBI'
getlogin_r_proto='REENTRANT_PROTO_I_BW'
getnetbyaddr_r_proto='REENTRANT_PROTO_S_TISBI'
getnetbyname_r_proto='REENTRANT_PROTO_S_CSBI'
getnetent_r_proto='REENTRANT_PROTO_S_SBI'
getprotobyname_r_proto='REENTRANT_PROTO_S_CSBI'
getprotobynumber_r_proto='REENTRANT_PROTO_S_ISBI'
getprotoent_r_proto='REENTRANT_PROTO_S_SBI'
getpwent_r_proto='REENTRANT_PROTO_S_SBW'
getpwnam_r_proto='REENTRANT_PROTO_I_CSBWR'
getpwuid_r_proto='REENTRANT_PROTO_I_TSBWR'
getservbyname_r_proto='REENTRANT_PROTO_S_CCSBI'
getservbyport_r_proto='REENTRANT_PROTO_S_ICSBI'
getservent_r_proto='REENTRANT_PROTO_S_SBI'
getspnam_r_proto='REENTRANT_PROTO_S_CSBI'
gidformat='"ld"'
gidsign='-1'
gidsize='4'
gidtype='gid_t'
glibpth='/usr/shlib  /lib /usr/lib /usr/lib/386 /lib/386 /usr/ccs/lib /usr/ucblib /usr/local/lib '
gmake='gmake'
gmtime_r_proto='REENTRANT_PROTO_S_TS'
gnulibc_version=''
grep='grep'
groupcat='cat /etc/group'
groupstype='gid_t'
gzip='gzip'
h_fcntl='false'
h_sysfile='true'
hint='recommended'
hostcat='cat /etc/hosts'
html1dir=' '
html1direxp=''
html3dir=' '
html3direxp=''
i16size='2'
i16type='short'
i32size='4'
i32type='long'
i64size='8'
i64type='long long'
i8size='1'
i8type='char'
i_arpainet='define'
i_bsdioctl=''
i_crypt='define'
i_db='define'
i_dbm='define'
i_dirent='define'
i_dld=''
i_dlfcn='define'
i_fcntl=''
i_float='define'
i_fp=''
i_fp_class='define'
i_gdbm=''
i_grp='define'
i_ieeefp='define'
i_inttypes='define'
i_langinfo='define'
i_libutil=''
i_limits='define'
i_locale='define'
i_machcthr=''
i_malloc='define'
i_math='define'
i_memory=''
i_mntent='define'
i_ndbm='define'
i_netdb='define'
i_neterrno=''
i_netinettcp='define'
i_niin='define'
i_poll='define'
i_prot=''
i_pthread='define'
i_pwd='define'
i_rpcsvcdbm=''
i_sfio=''
i_sgtty=''
i_shadow='define'
i_socks=''
i_stdarg='define'
i_stddef='define'
i_stdlib='define'
i_string='define'
i_sunmath=''
i_sysaccess=''
i_sysdir='define'
i_sysfile='define'
i_sysfilio='define'
i_sysin=''
i_sysioctl='define'
i_syslog='define'
i_sysmman='define'
i_sysmode=''
i_sysmount='define'
i_sysndir=''
i_sysparam='define'
i_sysresrc='define'
i_syssecrt=''
i_sysselct='define'
i_syssockio=''
i_sysstat='define'
i_sysstatfs='define'
i_sysstatvfs='define'
i_systime='define'
i_systimek=''
i_systimes='define'
i_systypes='define'
i_sysuio='define'
i_sysun='define'
i_sysutsname='define'
i_sysvfs='define'
i_syswait='define'
i_termio=''
i_termios='define'
i_time=''
i_unistd='define'
i_ustat='define'
i_utime='define'
i_values='define'
i_varargs=''
i_varhdr='stdarg.h'
i_vfork=''
ignore_versioned_solibs=''
inc_version_list=''
inc_version_list_init='0'
incpath=''
inews=''
installarchlib='/usr/local/lib/perl5/5.9.2/IP27-irix-thread-multi-64int-ld'
installbin='/usr/local/bin'
installhtml1dir=''
installhtml3dir=''
installman1dir='/usr/local/man/man1'
installman3dir='/usr/local/man/man3'
installprefix='/usr/local'
installprefixexp='/usr/local'
installprivlib='/usr/local/lib/perl5/5.9.2'
installscript='/usr/share/bin'
installsitearch='/usr/local/lib/perl5/site_perl/5.9.2/IP27-irix-thread-multi-64int-ld'
installsitebin='/usr/local/bin'
installsitehtml1dir=''
installsitehtml3dir=''
installsitelib='/usr/local/lib/perl5/site_perl/5.9.2'
installsiteman1dir='/usr/local/man/man1'
installsiteman3dir='/usr/local/man/man3'
installsitescript='/usr/local/bin'
installstyle='lib/perl5'
installusrbinperl=''
installvendorarch=''
installvendorbin=''
installvendorhtml1dir=''
installvendorhtml3dir=''
installvendorlib=''
installvendorman1dir=''
installvendorman3dir=''
installvendorscript=''
intsize='4'
issymlink='test -h'
ivdformat='"lld"'
ivsize='8'
ivtype='long long'
known_extensions='B ByteLoader Cwd DB_File Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call GDBM_File I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 NDBM_File ODBM_File Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Thread Time/HiRes Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared'
ksh=''
ld='cc -n32'
lddlflags='-n32 -shared -L/usr/local/lib'
ldflags=' -Wl,-woff,84 -L/usr/local/lib'
ldflags_uselargefiles=''
ldlibpthname='LD_LIBRARYN32_PATH'
less='less'
lib_ext='.a'
libc='/usr/lib32/libc.so'
libperl='libperl.a'
libpth='/usr/local/lib /usr/lib32 /lib32 /lib /usr/lib'
libs='-ldb -lm -lpthread'
libsdirs=' /usr/lib32'
libsfiles=' libdb.so libm.so libpthread.so'
libsfound=' /usr/lib32/libdb.so /usr/lib32/libm.so /usr/lib32/libpthread.so'
libspath=' /usr/local/lib /usr/lib32 /lib32 /lib /usr/lib'
libswanted='sfio inet nm ndbm gdbm dbm db dld ld m sec util pthread cposix posix ucb BSD'
libswanted_uselargefiles=''
line=''
lint=''
lkflags=''
ln='ln'
lns='/sbin/ln -s'
localtime_r_proto='REENTRANT_PROTO_S_TS'
locincpth='/usr/local/include /opt/local/include /usr/gnu/include /opt/gnu/include /usr/GNU/include /opt/GNU/include'
loclibpth='/usr/local/lib /opt/local/lib /usr/gnu/lib /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib'
longdblsize='16'
longlongsize='8'
longsize='4'
lp=''
lpr=''
ls='ls'
lseeksize='8'
lseektype='off_t'
mail=''
mailx=''
make='make'
make_set_make='#'
mallocobj=''
mallocsrc=''
malloctype='void *'
man1dir='/usr/local/man/man1'
man1direxp='/usr/local/man/man1'
man1ext='1'
man3dir='/usr/local/man/man3'
man3direxp='/usr/local/man/man3'
man3ext='3'
mips_type='System V'
mistrustnm=''
mkdir='mkdir'
mmaptype='void *'
modetype='mode_t'
more='more'
multiarch=''
mv=''
myarchname='IP27-irix'
mydomain='.rutgers.edu'
myhostname='dogberry'
myuname='irix64 dogberry 6.5 04091957 ip27 '
n=''
need_va_copy=''
netdb_hlen_type='int'
netdb_host_type='const void *'
netdb_name_type='const char *'
netdb_net_type='in_addr_t'
nm='nm'
nm_opt=' -p'
nm_so_opt=' -p'
nonxs_ext='Errno'
nroff='nroff'
nvEUformat='"LE"'
nvFUformat='"LF"'
nvGUformat='"LG"'
nv_preserves_uv_bits='64'
nveformat='"Le"'
nvfformat='"Lf"'
nvgformat='"Lg"'
nvsize='16'
nvtype='long double'
o_nonblock='O_NONBLOCK'
obj_ext='.o'
old_pthread_create_joinable=''
op_cflags=' optimize="$optimize -O2"'
opmini_cflags='optimize="$optimize -O2"'
optimize='-O3 -OPT:space=OFF:Olimit=0'
orderlib='false'
osname='irix'
osvers='6.5'
otherlibdirs=' '
package='perl5'
pager='/server/people/staff/easmith/compiled/less'
passcat='cat /etc/passwd'
patchlevel='9'
path_sep=':'
perl=''
perl5='/usr/sbin/perl'
perl_patchlevel='23485'
perladmin='easmith@dogberry.rutgers.edu'
perllibs='-lm -lpthread'
perlpath='/usr/local/bin/perl5.9.2'
pg='pg'
phostname='hostname'
pidtype='pid_t'
plibpth='/usr/lib32 /lib32 /usr/ccs/lib'
pmake=''
pr=''
prefix='/usr/local'
prefixexp='/usr/local'
privlib='/usr/local/lib/perl5/5.9.2'
privlibexp='/usr/local/lib/perl5/5.9.2'
procselfexe=''
prototype='define'
pthread_h_first='define'
ptrsize='4'
quadkind='3'
quadtype='long long'
randbits='48'
randfunc='drand48'
random_r_proto='0'
randseedtype='long'
ranlib=':'
rd_nodata='-1'
readdir64_r_proto='REENTRANT_PROTO_I_TSR'
readdir_r_proto='REENTRANT_PROTO_I_TSR'
revision='5'
rm='rm'
rmail=''
run=''
runnm='true'
sPRIEUldbl='"LE"'
sPRIFUldbl='"LF"'
sPRIGUldbl='"LG"'
sPRIXU64='"llX"'
sPRId64='"lld"'
sPRIeldbl='"Le"'
sPRIfldbl='"Lf"'
sPRIgldbl='"Lg"'
sPRIi64='"lli"'
sPRIo64='"llo"'
sPRIu64='"llu"'
sPRIx64='"llx"'
sSCNfldbl='"Lf"'
sched_yield='sched_yield()'
scriptdir='/usr/share/bin'
scriptdirexp='/usr/share/bin'
sed='sed'
seedfunc='srand48'
selectminbits='32'
selecttype='fd_set *'
sendmail=''
setgrent_r_proto='0'
sethostent_r_proto='0'
setlocale_r_proto='0'
setnetent_r_proto='0'
setprotoent_r_proto='0'
setpwent_r_proto='0'
setservent_r_proto='0'
sh='/bin/sh'
shar=''
sharpbang='#!'
shmattype='void *'
shortsize='2'
shrpenv=''
shsharp='true'
sig_count='65'
sig_name='ZERO HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM USR1 USR2 CHLD PWR WINCH URG IO STOP TSTP CONT TTIN TTOU VTALRM PROF XCPU XFSZ K32 CKPT RESTART UME NUM36 NUM37 NUM38 NUM39 NUM40 NUM41 NUM42 NUM43 NUM44 NUM45 NUM46 PTINTR PTRESCHED RTMIN NUM50 NUM51 NUM52 NUM53 NUM54 NUM55 NUM56 NUM57 NUM58 NUM59 NUM60 NUM61 NUM62 NUM63 RTMAX IOT CLD POLL '
sig_name_init='"ZERO", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "EMT", "FPE", "KILL", "BUS", "SEGV", "SYS", "PIPE", "ALRM", "TERM", "USR1", "USR2", "CHLD", "PWR", "WINCH", "URG", "IO", "STOP", "TSTP", "CONT", "TTIN", "TTOU", "VTALRM", "PROF", "XCPU", "XFSZ", "K32", "CKPT", "RESTART", "UME", "NUM36", "NUM37", "NUM38", "NUM39", "NUM40", "NUM41", "NUM42", "NUM43", "NUM44", "NUM45", "NUM46", "PTINTR", "PTRESCHED", "RTMIN", "NUM50", "NUM51", "NUM52", "NUM53", "NUM54", "NUM55", "NUM56", "NUM57", "NUM58", "NUM59", "NUM60", "NUM61", "NUM62", "NUM63", "RTMAX", "IOT", "CLD", "POLL", 0'
sig_num='0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 6 18 22 '
sig_num_init='0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 6, 18, 22, 0'
sig_size='68'
signal_t='void'
sitearch='/usr/local/lib/perl5/site_perl/5.9.2/IP27-irix-thread-multi-64int-ld'
sitearchexp='/usr/local/lib/perl5/site_perl/5.9.2/IP27-irix-thread-multi-64int-ld'
sitebin='/usr/local/bin'
sitebinexp='/usr/local/bin'
sitehtml1dir=''
sitehtml1direxp=''
sitehtml3dir=''
sitehtml3direxp=''
sitelib='/usr/local/lib/perl5/site_perl/5.9.2'
sitelib_stem='/usr/local/lib/perl5/site_perl'
sitelibexp='/usr/local/lib/perl5/site_perl/5.9.2'
siteman1dir='/usr/local/man/man1'
siteman1direxp='/usr/local/man/man1'
siteman3dir='/usr/local/man/man3'
siteman3direxp='/usr/local/man/man3'
siteprefix='/usr/local'
siteprefixexp='/usr/local'
sitescript='/usr/local/bin'
sitescriptexp='/usr/local/bin'
sizesize='4'
sizetype='size_t'
sleep=''
smail=''
so='so'
sockethdr=''
socketlib=''
socksizetype='int'
sort='sort'
spackage='Perl5'
spitshell='cat'
srand48_r_proto='0'
srandom_r_proto='0'
src='.'
ssizetype='ssize_t'
startperl='#!/usr/local/bin/perl5.9.2'
startsh='#!/bin/sh'
static_ext=' '
stdchar='unsigned char'
stdio_base='((fp)->_base)'
stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)'
stdio_cnt='((fp)->_cnt)'
stdio_filbuf=''
stdio_ptr='((fp)->_ptr)'
stdio_stream_array='__iob'
strerror_r_proto='0'
strings='/usr/include/string.h'
submit=''
subversion='2'
sysman='/usr/share/man/man1'
tail=''
tar=''
targetarch=''
tbl=''
tee=''
test='test'
timeincl='/usr/include/sys/time.h '
timetype='time_t'
tmpnam_r_proto='0'
to=':'
touch='touch'
tr='tr'
trnl='\n'
troff=''
ttyname_r_proto='REENTRANT_PROTO_I_IBW'
u16size='2'
u16type='unsigned short'
u32size='4'
u32type='unsigned long'
u64size='8'
u64type='unsigned long long'
u8size='1'
u8type='unsigned char'
uidformat='"ld"'
uidsign='-1'
uidsize='4'
uidtype='uid_t'
uname='uname'
uniq='uniq'
uquadtype='unsigned long long'
use5005threads=''
use64bitall=''
use64bitint='define'
usecrosscompile=''
usedl='define'
usefaststdio=''
useithreads='define'
uselargefiles='define'
uselongdouble='define'
usemallocwrap=''
usemorebits='define'
usemultiplicity='define'
usemymalloc='n'
usenm='true'
useopcode='true'
useperlio='define'
useposix='true'
usereentrant=''
usesfio='false'
useshrplib='false'
usesocks=''
usethreads='define'
usevendorprefix=''
usevfork='false'
usrinc='/usr/include'
uuname=''
uvXUformat='"llX"'
uvoformat='"llo"'
uvsize='8'
uvtype='unsigned long long'
uvuformat='"llu"'
uvxformat='"llx"'
vendorarch=''
vendorarchexp=''
vendorbin=''
vendorbinexp=''
vendorhtml1dir=' '
vendorhtml1direxp=''
vendorhtml3dir=' '
vendorhtml3direxp=''
vendorlib=''
vendorlib_stem=''
vendorlibexp=''
vendorman1dir=' '
vendorman1direxp=''
vendorman3dir=' '
vendorman3direxp=''
vendorprefix=''
vendorprefixexp=''
vendorscript=''
vendorscriptexp=''
version='5.9.2'
version_patchlevel_string='version 9 subversion 2 patch 23485'
versiononly='define'
vi=''
voidflags='15'
xlibpth='/usr/lib/386 /lib/386'
yacc='yacc'
yaccflags=''
zcat=''
zip='zip'

Loading

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Nov 9, 2004

From allens@cpan.org

The attached program tests for the presence of the bug in numeric.c's
Perl_my_atof2 of assuming less numeric precision to be possible than
actually is. It may need to be adjusted for an individual system; it
is currently set up for IRIX using long doubles. At the end of the
program are the test results for various values of MAX_SIG_DIG_PLUS,
including the current effective one of 2.

Loading

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Nov 9, 2004

Loading

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Nov 9, 2004

From allens@cpan.org

The attached is a patch to enable testing whether increasing the number
added to NV_DIG by numeric.c from the current 2 will improve accuracy of
Perl_my_atof2. It is applied in the main directory with -p0. Use
-Accflags='-DMAX_SIG_DIG_PLUS=#' when running Configure to test.

Loading

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Nov 9, 2004

From allens@cpan.org

numeric.c.patch
*** numeric.c.old	Tue Nov  9 09:38:46 2004
--- numeric.c	Tue Nov  9 09:38:46 2004
*************** Perl_my_atof2(pTHX_ const char* orig, NV
*** 875,881 ****
   * both the first and last digit, since neither can hold all values from
   * 0..9; but for calculating the value we must examine those two digits.
   */
! #define MAX_SIG_DIGITS (NV_DIG+2)
  
  /* the max number we can accumulate in a UV, and still safely do 10*N+9 */
  #define MAX_ACCUMULATE ( (UV) ((UV_MAX - 9)/10))
--- 875,888 ----
   * both the first and last digit, since neither can hold all values from
   * 0..9; but for calculating the value we must examine those two digits.
   */
! #ifdef MAX_SIG_DIG_PLUS
!     /* It is not necessarily the case that adding 2 to NV_DIG gets all the
!        possible digits in a NV, especially if NVs are not IEEE compliant
!        (e.g., long doubles on IRIX) - Allen <allens@cpan.org> */
! # define MAX_SIG_DIGITS (NV_DIG+MAX_SIG_DIG_PLUS)
! #else
! # define MAX_SIG_DIGITS (NV_DIG+2)
! #endif
  
  /* the max number we can accumulate in a UV, and still safely do 10*N+9 */
  #define MAX_ACCUMULATE ( (UV) ((UV_MAX - 9)/10))

Loading

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Nov 9, 2004

From easmith@beatrice.rutgers.edu

Well, for some reason RT does not seem to have forwarded to p5p the
information about the patch and test program (which includes sample
problematic output) I attached to the bug report. They are both included
below. If further comments on them are necessary, please check the RT
comments first.

  -Allen

*** numeric.c.old Tue Nov 9 09​:38​:46 2004
--- numeric.c Tue Nov 9 09​:38​:46 2004
*************** Perl_my_atof2(pTHX_ const char* orig, NV
*** 875,881 ****
  * both the first and last digit, since neither can hold all values from
  * 0..9; but for calculating the value we must examine those two digits.
  */
! #define MAX_SIG_DIGITS (NV_DIG+2)
 
  /* the max number we can accumulate in a UV, and still safely do 10*N+9 */
  #define MAX_ACCUMULATE ( (UV) ((UV_MAX - 9)/10))
--- 875,888 ----
  * both the first and last digit, since neither can hold all values from
  * 0..9; but for calculating the value we must examine those two digits.
  */
! #ifdef MAX_SIG_DIG_PLUS
! /* It is not necessarily the case that adding 2 to NV_DIG gets all the
! possible digits in a NV, especially if NVs are not IEEE compliant
! (e.g., long doubles on IRIX) - Allen <allens@​cpan.org> */
! # define MAX_SIG_DIGITS (NV_DIG+MAX_SIG_DIG_PLUS)
! #else
! # define MAX_SIG_DIGITS (NV_DIG+2)
! #endif
 
  /* the max number we can accumulate in a UV, and still safely do 10*N+9 */
  #define MAX_ACCUMULATE ( (UV) ((UV_MAX - 9)/10))

#!/tmp/allens/perl.5.9.x.4 -w

$max_sprintf = 49; # adjust as needed - must be at least 2 higher than max
  # of $num2_length; basic function is to avoid linewrap
  # when possible

$ok = 1;

foreach $num1_length (9..21) {
  foreach $num2_length (24..47) {
  if (($num2_length+2) > $max_sprintf) {
  die "Max sprintf is $max_sprintf; too low for num2_length "
  . $num2_length . "; stopped";
  }
  foreach $series (0,1,2,3) { # 5 avoided due to roundoff odd/even confusion
  my($a,$b,$c,$d);
  if ($series == 3) {
  $a = "6";
  $b = "7";
  $c = "8";
  $d = "9";
  } elsif ($series == 2) {
  $a = "4";
  $b = "3";
  $c = "2";
  $d = "1";
  } elsif ($series == 1) {
  $a = "9";
  $b = "8";
  $c = "7";
  $d = "6";
  } else {
  $a = "1";
  $b = "2";
  $c = "3";
  $d = "4";
  }

  my $num1 = "";
 
  until (length($num1) >= $num1_length) {
  $num1 .= $a;
  if (length($num1) < $num1_length) {
  $num1 .= $b;
  if (length($num1) < $num1_length) {
  $num1 .= $c;
  if (length($num1) < $num1_length) {
  $num1 .= $d;
  }
  }
  }
  }
 
  my $num2 = "0.";
 
  until (length($num2) >= $num2_length) {
  $num2 .= $a;
  if (length($num2) < $num2_length) {
  $num2 .= $b;
  if (length($num2) < $num2_length) {
  $num2 .= $c;
  if (length($num2) < $num2_length) {
  $num2 .= $d;
  }
  }
  }
  }

# print "\#NUM1 string ($num1_length)​:\t" . $num1 . "\n";
# print "\#NUM2 string ($num2_length)​:\t" . $num2 . "\n";

  my $tmp_num1 = $num1;
  my $tmp_num2 = $num2;
  $tmp_num2 =~ s/^0//;
 
  $num1 += 0;
  $num2 += 0;

# print "\#NUM1 number ($num1_length)​:\t" . $num1 . "\n";
# print "\#NUM2 number ($num2_length)​:\t" . $num2 . "\n";

# print "\#NUM1 sprintf ($num1_length)​:\t"
# . sprintf("%." . ($num1_length + 2) . "E",$num1) . "\n";
# print "\#NUM2 sprintf ($num2_length)​:\t"
# . sprintf("%." . ($num2_length + 2) . "E",$num2) . "\n";
 
  my $num = $num1 + $num2;

  my $sprintf_total = $num1_length + $num2_length;
  if ($sprintf_total > $max_sprintf) {
  $sprintf_total -= 17;
  if ($sprintf_total < $max_sprintf) {
  $sprintf_total = $max_sprintf;
  }
  }

  my $num_sprintf = sprintf("%." . $sprintf_total . "E",$num);

# print "\#NUM sprintf ($num1_length $num2_length)​:\t"
# . sprintf("%." . $sprintf_total . "E",$num) . "\n";

# print "\#\t\t\t1 23456789111111111122222222223333333333\n";
# print "\#\t\t\t 012345678901234567890123456789\n\n";

  my $tmp_num = $tmp_num1 . $tmp_num2;

# print "\#NUM string ($num1_length $num2_length)​:\t" . $tmp_num . "\n\n";
 
  my $tmp2_num = $tmp_num;

  $tmp2_num += 0;

  my $num_added = sprintf("%." . $sprintf_total. "E",$tmp2_num);

  if ($num_sprintf ne $num_added) {
  $ok = 0;
  print "\#NUM string ($num1_length $num2_length)​:\t" . $tmp_num
  . "\n\n";
  print "\#NUM sprintf ($num1_length $num2_length)​:\t"
  . $num_sprintf . "\n";
  print "\#\t\t\t1 23456789111111111122222222223333333333\n";
  print "\#\t\t\t 012345678901234567890123456789\n\n";

  print "\#NUM added ($num1_length $num2_length)​:\t"
  . $num_added . "\n";
  print "\#\t\t\t1 23456789111111111122222222223333333333\n";
  print "\#\t\t\t 012345678901234567890123456789\n\n";
  }
  }
  }
}

if ($ok) {
  print "\#NUM OK!\n";
}

#MAX_SIG_DIG_PLUS=2 (via MAX_SIG_DIG_PLUS undef)​:

#NUM string (13 24)​: 4321432143214.4321432143214321432143

#NUM sprintf (13 24)​: 4.3214321432144321432143214321432260000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 24)​: 4.3214321432144321432143214321431990000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 25)​: 4321432143214.43214321432143214321432

#NUM sprintf (13 25)​: 4.32143214321443214321432143214322600000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 25)​: 4.32143214321443214321432143214319900000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 26)​: 4321432143214.432143214321432143214321

#NUM sprintf (13 26)​: 4.321432143214432143214321432143226000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 26)​: 4.321432143214432143214321432143199000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 27)​: 4321432143214.4321432143214321432143214

#NUM sprintf (13 27)​: 4.3214321432144321432143214321432260000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 27)​: 4.3214321432144321432143214321431990000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 28)​: 4321432143214.43214321432143214321432143

#NUM sprintf (13 28)​: 4.32143214321443214321432143214322600000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 28)​: 4.32143214321443214321432143214319900000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 29)​: 4321432143214.432143214321432143214321432

#NUM sprintf (13 29)​: 4.321432143214432143214321432143226000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 29)​: 4.321432143214432143214321432143199000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 30)​: 4321432143214.4321432143214321432143214321

#NUM sprintf (13 30)​: 4.3214321432144321432143214321432260000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 30)​: 4.3214321432144321432143214321431990000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 31)​: 4321432143214.43214321432143214321432143214

#NUM sprintf (13 31)​: 4.32143214321443214321432143214322600000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 31)​: 4.32143214321443214321432143214319900000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 32)​: 4321432143214.432143214321432143214321432143

#NUM sprintf (13 32)​: 4.321432143214432143214321432143226000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 32)​: 4.321432143214432143214321432143199000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 33)​: 4321432143214.4321432143214321432143214321432

#NUM sprintf (13 33)​: 4.3214321432144321432143214321432260000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 33)​: 4.3214321432144321432143214321431990000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 34)​: 4321432143214.43214321432143214321432143214321

#NUM sprintf (13 34)​: 4.32143214321443214321432143214322600000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 34)​: 4.32143214321443214321432143214319900000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 35)​: 4321432143214.432143214321432143214321432143214

#NUM sprintf (13 35)​: 4.321432143214432143214321432143226000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 35)​: 4.321432143214432143214321432143199000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 36)​: 4321432143214.4321432143214321432143214321432143

#NUM sprintf (13 36)​: 4.3214321432144321432143214321432260000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 36)​: 4.3214321432144321432143214321431990000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 37)​: 4321432143214.43214321432143214321432143214321432

#NUM sprintf (13 37)​: 4.3214321432144321432143214321432260000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 37)​: 4.3214321432144321432143214321431990000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 38)​: 4321432143214.432143214321432143214321432143214321

#NUM sprintf (13 38)​: 4.3214321432144321432143214321432260000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 38)​: 4.3214321432144321432143214321431990000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 39)​: 4321432143214.4321432143214321432143214321432143214

#NUM sprintf (13 39)​: 4.3214321432144321432143214321432260000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 39)​: 4.3214321432144321432143214321431990000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 40)​: 4321432143214.43214321432143214321432143214321432143

#NUM sprintf (13 40)​: 4.3214321432144321432143214321432260000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 40)​: 4.3214321432144321432143214321431990000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 41)​: 4321432143214.432143214321432143214321432143214321432

#NUM sprintf (13 41)​: 4.3214321432144321432143214321432260000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 41)​: 4.3214321432144321432143214321431990000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 42)​: 4321432143214.4321432143214321432143214321432143214321

#NUM sprintf (13 42)​: 4.3214321432144321432143214321432260000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 42)​: 4.3214321432144321432143214321431990000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 43)​: 4321432143214.43214321432143214321432143214321432143214

#NUM sprintf (13 43)​: 4.3214321432144321432143214321432260000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 43)​: 4.3214321432144321432143214321431990000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 44)​: 4321432143214.432143214321432143214321432143214321432143

#NUM sprintf (13 44)​: 4.3214321432144321432143214321432260000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 44)​: 4.3214321432144321432143214321431990000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 45)​: 4321432143214.4321432143214321432143214321432143214321432

#NUM sprintf (13 45)​: 4.3214321432144321432143214321432260000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 45)​: 4.3214321432144321432143214321431990000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 46)​: 4321432143214.43214321432143214321432143214321432143214321

#NUM sprintf (13 46)​: 4.3214321432144321432143214321432260000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 46)​: 4.3214321432144321432143214321431990000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (13 47)​: 4321432143214.432143214321432143214321432143214321432143214

#NUM sprintf (13 47)​: 4.3214321432144321432143214321432260000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (13 47)​: 4.3214321432144321432143214321431990000000000000000E+12
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 24)​: 123412341234123.1234123412341234123412

#NUM sprintf (15 24)​: 1.234123412341231234123412341234126000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 24)​: 1.234123412341231234123412341234117000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 25)​: 123412341234123.12341234123412341234123

#NUM sprintf (15 25)​: 1.2341234123412312341234123412341260000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 25)​: 1.2341234123412312341234123412341170000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 26)​: 123412341234123.123412341234123412341234

#NUM sprintf (15 26)​: 1.23412341234123123412341234123412600000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 26)​: 1.23412341234123123412341234123411700000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 27)​: 123412341234123.1234123412341234123412341

#NUM sprintf (15 27)​: 1.234123412341231234123412341234126000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 27)​: 1.234123412341231234123412341234117000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 28)​: 123412341234123.12341234123412341234123412

#NUM sprintf (15 28)​: 1.2341234123412312341234123412341260000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 28)​: 1.2341234123412312341234123412341170000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 29)​: 123412341234123.123412341234123412341234123

#NUM sprintf (15 29)​: 1.23412341234123123412341234123412600000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 29)​: 1.23412341234123123412341234123411700000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 30)​: 123412341234123.1234123412341234123412341234

#NUM sprintf (15 30)​: 1.234123412341231234123412341234126000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 30)​: 1.234123412341231234123412341234117000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 31)​: 123412341234123.12341234123412341234123412341

#NUM sprintf (15 31)​: 1.2341234123412312341234123412341260000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 31)​: 1.2341234123412312341234123412341170000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 32)​: 123412341234123.123412341234123412341234123412

#NUM sprintf (15 32)​: 1.23412341234123123412341234123412600000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 32)​: 1.23412341234123123412341234123411700000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 33)​: 123412341234123.1234123412341234123412341234123

#NUM sprintf (15 33)​: 1.234123412341231234123412341234126000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 33)​: 1.234123412341231234123412341234117000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 34)​: 123412341234123.12341234123412341234123412341234

#NUM sprintf (15 34)​: 1.2341234123412312341234123412341260000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 34)​: 1.2341234123412312341234123412341170000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 35)​: 123412341234123.123412341234123412341234123412341

#NUM sprintf (15 35)​: 1.2341234123412312341234123412341260000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 35)​: 1.2341234123412312341234123412341170000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 36)​: 123412341234123.1234123412341234123412341234123412

#NUM sprintf (15 36)​: 1.2341234123412312341234123412341260000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 36)​: 1.2341234123412312341234123412341170000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 37)​: 123412341234123.12341234123412341234123412341234123

#NUM sprintf (15 37)​: 1.2341234123412312341234123412341260000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 37)​: 1.2341234123412312341234123412341170000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 38)​: 123412341234123.123412341234123412341234123412341234

#NUM sprintf (15 38)​: 1.2341234123412312341234123412341260000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 38)​: 1.2341234123412312341234123412341170000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 39)​: 123412341234123.1234123412341234123412341234123412341

#NUM sprintf (15 39)​: 1.2341234123412312341234123412341260000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 39)​: 1.2341234123412312341234123412341170000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 40)​: 123412341234123.12341234123412341234123412341234123412

#NUM sprintf (15 40)​: 1.2341234123412312341234123412341260000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 40)​: 1.2341234123412312341234123412341170000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 41)​: 123412341234123.123412341234123412341234123412341234123

#NUM sprintf (15 41)​: 1.2341234123412312341234123412341260000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 41)​: 1.2341234123412312341234123412341170000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 42)​: 123412341234123.1234123412341234123412341234123412341234

#NUM sprintf (15 42)​: 1.2341234123412312341234123412341260000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 42)​: 1.2341234123412312341234123412341170000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 43)​: 123412341234123.12341234123412341234123412341234123412341

#NUM sprintf (15 43)​: 1.2341234123412312341234123412341260000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 43)​: 1.2341234123412312341234123412341170000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 44)​: 123412341234123.123412341234123412341234123412341234123412

#NUM sprintf (15 44)​: 1.2341234123412312341234123412341260000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 44)​: 1.2341234123412312341234123412341170000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 45)​: 123412341234123.1234123412341234123412341234123412341234123

#NUM sprintf (15 45)​: 1.2341234123412312341234123412341260000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 45)​: 1.2341234123412312341234123412341170000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 46)​: 123412341234123.12341234123412341234123412341234123412341234

#NUM sprintf (15 46)​: 1.2341234123412312341234123412341260000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 46)​: 1.2341234123412312341234123412341170000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (15 47)​: 123412341234123.123412341234123412341234123412341234123412341

#NUM sprintf (15 47)​: 1.2341234123412312341234123412341260000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (15 47)​: 1.2341234123412312341234123412341170000000000000000E+14
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 24)​: 123412341234123412.1234123412341234123412

#NUM sprintf (18 24)​: 1.234123412341234121234123412341237000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 24)​: 1.234123412341234121234123412341228000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 25)​: 123412341234123412.12341234123412341234123

#NUM sprintf (18 25)​: 1.2341234123412341212341234123412370000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 25)​: 1.2341234123412341212341234123412280000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 26)​: 123412341234123412.123412341234123412341234

#NUM sprintf (18 26)​: 1.23412341234123412123412341234123700000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 26)​: 1.23412341234123412123412341234122800000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 27)​: 123412341234123412.1234123412341234123412341

#NUM sprintf (18 27)​: 1.234123412341234121234123412341237000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 27)​: 1.234123412341234121234123412341228000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 28)​: 123412341234123412.12341234123412341234123412

#NUM sprintf (18 28)​: 1.2341234123412341212341234123412370000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 28)​: 1.2341234123412341212341234123412280000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 29)​: 123412341234123412.123412341234123412341234123

#NUM sprintf (18 29)​: 1.23412341234123412123412341234123700000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 29)​: 1.23412341234123412123412341234122800000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 30)​: 123412341234123412.1234123412341234123412341234

#NUM sprintf (18 30)​: 1.234123412341234121234123412341237000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 30)​: 1.234123412341234121234123412341228000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 31)​: 123412341234123412.12341234123412341234123412341

#NUM sprintf (18 31)​: 1.2341234123412341212341234123412370000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 31)​: 1.2341234123412341212341234123412280000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 32)​: 123412341234123412.123412341234123412341234123412

#NUM sprintf (18 32)​: 1.2341234123412341212341234123412370000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 32)​: 1.2341234123412341212341234123412280000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 33)​: 123412341234123412.1234123412341234123412341234123

#NUM sprintf (18 33)​: 1.2341234123412341212341234123412370000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 33)​: 1.2341234123412341212341234123412280000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 34)​: 123412341234123412.12341234123412341234123412341234

#NUM sprintf (18 34)​: 1.2341234123412341212341234123412370000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 34)​: 1.2341234123412341212341234123412280000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 35)​: 123412341234123412.123412341234123412341234123412341

#NUM sprintf (18 35)​: 1.2341234123412341212341234123412370000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 35)​: 1.2341234123412341212341234123412280000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 36)​: 123412341234123412.1234123412341234123412341234123412

#NUM sprintf (18 36)​: 1.2341234123412341212341234123412370000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 36)​: 1.2341234123412341212341234123412280000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 37)​: 123412341234123412.12341234123412341234123412341234123

#NUM sprintf (18 37)​: 1.2341234123412341212341234123412370000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 37)​: 1.2341234123412341212341234123412280000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 38)​: 123412341234123412.123412341234123412341234123412341234

#NUM sprintf (18 38)​: 1.2341234123412341212341234123412370000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 38)​: 1.2341234123412341212341234123412280000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 39)​: 123412341234123412.1234123412341234123412341234123412341

#NUM sprintf (18 39)​: 1.2341234123412341212341234123412370000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 39)​: 1.2341234123412341212341234123412280000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 40)​: 123412341234123412.12341234123412341234123412341234123412

#NUM sprintf (18 40)​: 1.2341234123412341212341234123412370000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 40)​: 1.2341234123412341212341234123412280000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 41)​: 123412341234123412.123412341234123412341234123412341234123

#NUM sprintf (18 41)​: 1.2341234123412341212341234123412370000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 41)​: 1.2341234123412341212341234123412280000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 42)​: 123412341234123412.1234123412341234123412341234123412341234

#NUM sprintf (18 42)​: 1.2341234123412341212341234123412370000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 42)​: 1.2341234123412341212341234123412280000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 43)​: 123412341234123412.12341234123412341234123412341234123412341

#NUM sprintf (18 43)​: 1.2341234123412341212341234123412370000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 43)​: 1.2341234123412341212341234123412280000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 44)​: 123412341234123412.123412341234123412341234123412341234123412

#NUM sprintf (18 44)​: 1.2341234123412341212341234123412370000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 44)​: 1.2341234123412341212341234123412280000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 45)​: 123412341234123412.1234123412341234123412341234123412341234123

#NUM sprintf (18 45)​: 1.2341234123412341212341234123412370000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 45)​: 1.2341234123412341212341234123412280000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 46)​: 123412341234123412.12341234123412341234123412341234123412341234

#NUM sprintf (18 46)​: 1.2341234123412341212341234123412370000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 46)​: 1.2341234123412341212341234123412280000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM string (18 47)​: 123412341234123412.123412341234123412341234123412341234123412341

#NUM sprintf (18 47)​: 1.2341234123412341212341234123412370000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#NUM added (18 47)​: 1.2341234123412341212341234123412280000000000000000E+17
# 1 23456789111111111122222222223333333333
# 012345678901234567890123456789

#MAX_SIG_DIG_PLUS=3​:

#NUM OK!

#MAX_SIG_DIG_PLUS=4​:

#NUM OK!

--
Allen Smith http​://cesario.rutgers.edu/easmith/
September 11, 2001 A Day That Shall Live In Infamy II
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." - Benjamin Franklin

Loading

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Nov 9, 2004

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

Loading

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Oct 3, 2010

From @cpansprout

On Tue Nov 09 07​:17​:35 2004, easmith@​beatrice.rutgers.edu wrote​:

Well, for some reason RT does not seem to have forwarded to p5p the
information about the patch and test program (which includes sample
problematic output) I attached to the bug report. They are both
included
below. If further comments on them are necessary, please check the RT
comments first.

 \-Allen

*** numeric.c.old Tue Nov 9 09​:38​:46 2004
--- numeric.c Tue Nov 9 09​:38​:46 2004
*************** Perl_my_atof2(pTHX_ const char* orig, NV
*** 875,881 ****
* both the first and last digit, since neither can hold all values
from
* 0..9; but for calculating the value we must examine those two
digits.
*/
! #define MAX_SIG_DIGITS (NV_DIG+2)

/* the max number we can accumulate in a UV, and still safely do
10*N+9 */
#define MAX_ACCUMULATE ( (UV) ((UV_MAX - 9)/10))
--- 875,888 ----
* both the first and last digit, since neither can hold all values
from
* 0..9; but for calculating the value we must examine those two
digits.
*/
! #ifdef MAX_SIG_DIG_PLUS
! /* It is not necessarily the case that adding 2 to NV_DIG gets
all the
! possible digits in a NV, especially if NVs are not IEEE
compliant
! (e.g., long doubles on IRIX) - Allen <allens@​cpan.org> */
! # define MAX_SIG_DIGITS (NV_DIG+MAX_SIG_DIG_PLUS)
! #else
! # define MAX_SIG_DIGITS (NV_DIG+2)
! #endif

/* the max number we can accumulate in a UV, and still safely do
10*N+9 */
#define MAX_ACCUMULATE ( (UV) ((UV_MAX - 9)/10))

Thank you. I’ve applied your patch to numeric.c as ffa277e.

I have not applied the test yet. How can I detect, from within the test,
that it is running on IRIX and that it is the right version of IRIX?
(Are there version difference, with regard to floating-point semantic?)

Loading

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Oct 3, 2010

From @cpansprout

On Sun Oct 03 15​:57​:59 2010, sprout wrote​:

(Are there version difference, with regard to floating-point semantic?)

Let’s try that again, with all the S’s​:

Are there version differences, with regard to floating-point semantics?

Loading

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Oct 4, 2010

From actual@spamcop.net

Quoting Father Chrysostomos via RT <perlbug-followup@​perl.org>​:

On Tue Nov 09 07​:17​:35 2004, easmith@​beatrice.rutgers.edu wrote​:

Well, for some reason RT does not seem to have forwarded to p5p the
information about the patch and test program (which includes sample
problematic output) I attached to the bug report. They are both
included
below. If further comments on them are necessary, please check the RT
comments first.

 \-Allen

*** numeric.c.old Tue Nov 9 09​:38​:46 2004
--- numeric.c Tue Nov 9 09​:38​:46 2004
*************** Perl_my_atof2(pTHX_ const char* orig, NV
*** 875,881 ****
* both the first and last digit, since neither can hold all values
from
* 0..9; but for calculating the value we must examine those two
digits.
*/
! #define MAX_SIG_DIGITS (NV_DIG+2)

/* the max number we can accumulate in a UV, and still safely do
10*N+9 */
#define MAX_ACCUMULATE ( (UV) ((UV_MAX - 9)/10))
--- 875,888 ----
* both the first and last digit, since neither can hold all values
from
* 0..9; but for calculating the value we must examine those two
digits.
*/
! #ifdef MAX_SIG_DIG_PLUS
! /* It is not necessarily the case that adding 2 to NV_DIG gets
all the
! possible digits in a NV, especially if NVs are not IEEE
compliant
! (e.g., long doubles on IRIX) - Allen <allens@​cpan.org> */
! # define MAX_SIG_DIGITS (NV_DIG+MAX_SIG_DIG_PLUS)
! #else
! # define MAX_SIG_DIGITS (NV_DIG+2)
! #endif

/* the max number we can accumulate in a UV, and still safely do
10*N+9 */
#define MAX_ACCUMULATE ( (UV) ((UV_MAX - 9)/10))

Thank you. I’ve applied your patch to numeric.c as ffa277e.

I have not applied the test yet. How can I detect, from within the test,
that it is running on IRIX and that it is the right version of IRIX?
(Are there version difference, with regard to floating-point semantic?)

Quite possibly. You should probably consult with someone who's still
using IRIX, however, since I can't now test anything on IRIX
(graduated).

  -Allen

--
Allen Smith, Ph.D. http​://www.drallensmith.org
Please note former email address of easmith@​beatrice.rutgers.edu

Loading

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jul 2, 2013

From @tonycoz

On Sun Oct 03 15​:57​:59 2010, sprout wrote​:

Thank you. I’ve applied your patch to numeric.c as ffa277e.

I have not applied the test yet. How can I detect, from within the test,
that it is running on IRIX and that it is the right version of IRIX?
(Are there version difference, with regard to floating-point semantic?)

I've marked the patch as applied in RT.

I expect the fix would be​:

- some test (as a test, not a standalone script) to test that numeric
conversion is accurate

- updates to hints/ for the appropriate platforms.

If this was only IRIX I'd be tempted to simply close the ticket, but
41202 and 47087 describe similar problems.

Tony

Loading

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Feb 22, 2016

From @mauke

On Tue Jul 02 00​:00​:36 2013, tonyc wrote​:

On Sun Oct 03 15​:57​:59 2010, sprout wrote​:

Thank you. I’ve applied your patch to numeric.c as ffa277e.

I have not applied the test yet. How can I detect, from within the test,
that it is running on IRIX and that it is the right version of IRIX?
(Are there version difference, with regard to floating-point semantic?)

I've marked the patch as applied in RT.

I expect the fix would be​:

- some test (as a test, not a standalone script) to test that numeric
conversion is accurate

- updates to hints/ for the appropriate platforms.

If this was only IRIX I'd be tempted to simply close the ticket, but
41202 and 47087 describe similar problems.

This ticket is listed in perl5140delta​:

  IRIX
  * Conversion of strings to floating-point numbers is now more accurate
  on IRIX systems [perl #32380].

Should it still remain open?

Loading

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Feb 23, 2017

From @khwilliamson

On Mon, 22 Feb 2016 13​:13​:32 -0800, mauke- wrote​:

On Tue Jul 02 00​:00​:36 2013, tonyc wrote​:

On Sun Oct 03 15​:57​:59 2010, sprout wrote​:

Thank you. I’ve applied your patch to numeric.c as ffa277e.

I have not applied the test yet. How can I detect, from within the test,
that it is running on IRIX and that it is the right version of IRIX?
(Are there version difference, with regard to floating-point semantic?)

I've marked the patch as applied in RT.

I expect the fix would be​:

- some test (as a test, not a standalone script) to test that numeric
conversion is accurate

- updates to hints/ for the appropriate platforms.

If this was only IRIX I'd be tempted to simply close the ticket, but
41202 and 47087 describe similar problems.

This ticket is listed in perl5140delta​:

IRIX
* Conversion of strings to floating-point numbers is now more accurate
on IRIX systems [perl #32380].

Should it still remain open?

Pinging on this ticket, a year later

--
Karl Williamson

Loading

@khwilliamson
Copy link
Contributor

@khwilliamson khwilliamson commented Dec 19, 2019

RT #41202 referred to above has been fixed (GH #8730 ) and no longer should be a consideration for keeping this ticket open. Given the lack of response in almost 4 years, and that there have been other fixes that could help this, and that RT #47087 (GH #9095) remains open, I will add a reference to this ticket there, and close this.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants