Subject: | Incompatibility with Math::BigInt >= 1.49 |
Hi,
when using Math::NumberCruncher with current versions (>= 1.49) of
Math::BigInt, the Predict() function can not handle data generated by
BestFit(), but rather returns NaN.
This occurs because BestFit() explicitly rounds its return values into a
fixed precision, but Predict() calls Math::BigFloat::bmul with an
explicit accuracy. Since version 1.49 Math::BigInt::round enforces that
its operands must have either a specified precision or specified
accuracy. If these are different, NaN is returned from
Math::BigInt::round(), called by Math::BigFloat::bmul().
I'm attaching a patch for test.pl that detects this bug. The bug can be
worked around by setting $slope->accuracy(undef) and
$y_intercept->accuracy(undef) before calling Predict().
Since there are lots of similar calls to bmul() in Math::NumberCruncher,
I suspect that this is a more general problem.
For the record, this bug was originally reported by Thomas Walter in the
Debian bug tracking database as bug #352393, http://bugs.debian.org/352393 .
I have verified this bug on Debian GNU/Linux with Perl versions 5.6.1,
5.8.4 and 5.8.7 with Math::BigInt versions 1.56, 1.70 and 1.77
Cheers,
--
Niko Tyni (on behalf of the Debian Perl Group)
ntyni@iki.fi
Subject: | NaN-test |
Message body not shown because it is not plain text.