Package: libmath-numbercruncher-perl
Version: 5.00-1
Severity: important

Hello,
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'.

Example code snippet:

use v5.6.1;
use warnings;
use strict;

use Math::NumberCruncher;

my @array1 = (0, 1, 2, 3);
my @array2 = (5, 10, 12, 10);

my ($slope, $y_intercept) = Math::NumberCruncher::BestFit([EMAIL PROTECTED],
[EMAIL PROTECTED]);

print "\$slope       = ", $slope, "\n";
print "\$y_intercept = ", $y_intercept, "\n";

my $proposed_x = 4;
my $predicted_value = Math::NumberCruncher::Predict( $slope,
$y_intercept, 4);
#my $predicted_value = Math::NumberCruncher::Predict( 0.1, 3.1, 4); #
runs fine
#my $predicted_value = Math::NumberCruncher::Predict( int($slope *1e8) /
1e8, int($y_intercept * 1e8)/1e8, $proposed_x); # OK too
print "\$proposed_x      = ", $proposed_x, "\n";
print "\$predicted_value = ", $predicted_value, "\n";

end of code snippet

As there is no wrong answer when using rounded values and when looking
at the variables using 'perl -d' I assume the root of the issue is
 related to BigFloat numbers returned by 'BestFit'.  When feeding
"normal" perl numbers into 'Predict' then everything is fine.

Kind Regards,
Thomas Walter
[EMAIL PROTECTED]


-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux seneca.org.eu 2.4.27 #2 Sun Apr 10 14:22:04 CEST 2005 i686
Locale: LANG=de, LC_CTYPE=C

Versions of packages libmath-numbercruncher-perl depends on:
ii  libmath-bigint-perl           1.56-1     Perl5 module for math.
operation o
ii  perl                          5.6.1-8.9  Larry Wall's Practical
Extraction 





-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to