Subject: | For some values of x, blog(x) returns blog(2*x) when the accuracy is >= 71 |
Consider the following code snippet:
---
use Math::BigFloat;
my $x = Math::BigFloat->new(15);
$x->accuracy(70);
print $x->copy->blog, "\n"; # 2.7...
$x->accuracy(71);
print $x->blog, "\n"; # 3.4...
---
the first print produces 2.7... (which is correct) while, once increased
the accuracy from 70 to 71, the second print produces 3.4..., which is
wrong ( it actually is log(2*$x) - or log($x)+log(2) ).
It happens only for some values of $x (e.g. 11..19, but also for very
big numbers).
Attached is a new test file (accuracy_biglog.t - which tries to adhere
to the Math::BigInt test standards) containing a failing test.
Thanks for your invaluable work,
Emanuele Zeppieri
Subject: | perl-V.txt |
Summary of my perl5 (revision 5 version 10 subversion 0 patch 34065) configuration:
Platform:
osname=cygwin, osvers=1.5.25(0.15642), archname=cygwin-thread-multi-64int
uname='cygwin_nt-5.1 reini 1.5.25(0.15642) 2008-06-12 19:34 i686 cygwin '
config_args='-de -Dmksymlinks -Dusethreads -Dmad=y -Dusedevel'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=undef, uselongdouble=undef
usemymalloc=y, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -fno-strict-aliasing -pipe -I/usr/local/include',
optimize='-O3',
cppflags='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -fno-strict-aliasing -pipe -I/usr/local/include'
ccversion='', gccversion='3.4.4 (cygming special, gdc 0.12, using dmd 0.125)', 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='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='g++', ldflags =' -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--stack,8388608 -Wl,--enable-auto-image-base -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib /lib
libs=-lgdbm -ldb -ldl -lcrypt -lgdbm_compat
perllibs=-ldl -lcrypt
libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' --shared -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--stack,8388608 -Wl,--enable-auto-image-base -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY MYMALLOC PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT PERL_MAD PERL_MALLOC_WRAP
PERL_USE_SAFE_PUTENV USE_64_BIT_INT USE_ITHREADS
USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API
Locally applied patches:
MAINT34065
CYG11 no-bs
CYG12 no archlib in otherlibdirs
CYG14 Dynaloader
CYG15 static-Win32CORE
Bug#55162 File::Spec::case_tolerant performance
Built under cygwin
Compiled at Jun 30 2008 16:05:15
%ENV:
CYGWIN=""
@INC:
/usr/lib/perl5/5.10/i686-cygwin
/usr/lib/perl5/5.10
/usr/lib/perl5/site_perl/5.10/i686-cygwin
/usr/lib/perl5/site_perl/5.10
/usr/lib/perl5/vendor_perl/5.10/i686-cygwin
/usr/lib/perl5/vendor_perl/5.10
/usr/lib/perl5/vendor_perl/5.10
/usr/lib/perl5/site_perl/5.8
/usr/lib/perl5/vendor_perl/5.8
.
Subject: | accuracy_biglog.t |
#!/usr/bin/perl -w
# Emanuele Zeppieri
#
# Failing test for a bug in 1.89 which causes blog(x) to return blog(x)+blog(2)
# for some values of x, when the accuracy is >= 71.
use Test::More;
use strict;
BEGIN
{
$| = 1;
# to locate the testing files
my $location = $0; $location =~ s/bigroot.t//i;
if ($ENV{PERL_CORE})
{
# testing with the core distribution
@INC = qw(../lib);
}
unshift @INC, '../lib';
if (-d 't')
{
chdir 't';
require File::Spec;
unshift @INC, File::Spec->catdir(File::Spec->updir, $location);
}
else
{
unshift @INC, $location;
}
print "# INC = @INC\n";
plan tests => 1;
}
use Math::BigFloat;
my $cl = "Math::BigFloat";
#############################################################################
# test blog(x,a) with the failing values x=15 and a=71
like ($cl->new(15)->blog(undef,71), qr/^2\.7080502011022100659960045701487133/);
# all done