Bug#352454: libmath-numbercruncher-perl: Feeding the results of 'BestFit' into 'Predict' results in a wrong answer, in my case 'NAN'.

Niko Tyni ntyni at iki.fi
Sun Feb 12 20:09:23 UTC 2006


tags 352454 upstream
forwarded 352454 http://rt.cpan.org/Ticket/Display.html?id=17600
thanks

> while using libmath-numbercruncher-perl I found the following issue.
> Feeding the results of 'BestFit' into 'Predict' results in a wrong answer, in my case 'NAN'.

Hi,

this is an incompatibility between Math::NumberCruncher and current
versions of Math::BigInt. It happens because BestFit() rounds
its return values into a fixed precision, while Predict() calls
Math::BigFloat::bmul() with a specific accuracy. Since version 1.49
Math::BigInt enforces that only one of these can be specified, and 
returns NaN if this is not the case.

I have forwarded your report to the upstream bug tracking database
at http://rt.cpan.org/Ticket/Display.html?id=17600 . I don't have
a good fix, but a workaround is to explicitly reset the accuracy
of the arguments of Predict():

my ($slope, $y_intercept) = Math::NumberCruncher::BestFit(\@array1, \@array2);
$slope->accuracy(undef);
$y_intercept->accuracy(undef);
my $predicted_value = Math::NumberCruncher::Predict( $slope, $y_intercept, 4);

Thank you for your report,
-- 
Niko Tyni	ntyni at iki.fi




More information about the pkg-perl-maintainers mailing list