Subject: | t/json-basic fails due to rounding errors |
t/json-basic...........NOK 5/42
# Failed test 'roundtrip 2.1 -> '2.10000000000000009' ->
2.10000000000000009'
# in t/json-basic.t at line 62.
# got: '2.10000000000000009'# expected: '2.1'
t/json-basic...........NOK 8/42
# Failed test 'roundtrip [1.1,2.2,3.3] ->
['1.10000000000000009','2.20000000000000018','3.29999999999999982'] ->
[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# in t/json-basic.t at line 62.
# got:
'[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# expected: '[1.1,2.2,3.3]'
t/json-basic...........NOK 9/42
# Failed test 'roundtrip [1.1,2.2,3.3] ->
['1.10000000000000009','2.20000000000000018','3.29999999999999982'] ->
[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# in t/json-basic.t at line 62.
# got:
'[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# expected: '[1.1,2.2,3.3]'
t/json-basic...........NOK 26/42
# Failed test 'roundtrip 2.1 -> '2.10000000000000009' ->
2.10000000000000009'
# in t/json-basic.t at line 62.
# got: '2.10000000000000009'
# expected: '2.1'
t/json-basic...........NOK 29/42
# Failed test 'roundtrip [1.1,2.2,3.3] ->
['1.10000000000000009','2.20000000000000018','3.29999999999999982'] ->
[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# in t/json-basic.t at line 62.
# got:
'[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# expected: '[1.1,2.2,3.3]'
t/json-basic...........NOK 30/42
# Failed test 'roundtrip [1.1,2.2,3.3] ->
['1.10000000000000009','2.20000000000000018','3.29999999999999982'] ->
[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# in t/json-basic.t at line 62.
# got:
'[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# expected: '[1.1,2.2,3.3]'
# Looks like you failed 6 tests of 42.
t/json-basic...........dubious
Test returned status 6 (wstat 1536, 0x600)
DIED. FAILED tests 5, 8-9, 26, 29-30
Failed 6/42 tests, 85.71% okay
I guess the problem is due to me using a Perl interpreter with 64 bit
integers and/or long doubles:
fany@bigblue:~> perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
Platform:
osname=linux, osvers=2.6.13-15.7-default, archname=i686-linux-64int-ld
uname='linux bigblue 2.6.13-15.7-default #1 tue nov 29 14:32:29 utc
2005 i686 i686 i386 gnulinux '
config_args='-e'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=define use64bitall=undef uselongdouble=define
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-strict-aliasing -pipe
-Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
optimize='-O2 -march=pentium4',
cppflags='-fno-strict-aliasing -pipe -Wdeclaration-after-statement
-I/usr/local/include'
ccversion='', gccversion='4.0.2 20050901 (prerelease) (SUSE Linux)',
gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long long', ivsize=8, nvtype='long double', nvsize=12,
Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.3.5.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.3.5'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: PERL_MALLOC_WRAP USE_64_BIT_INT USE_LARGE_FILES
USE_LONG_DOUBLE USE_PERLIO