Skip Menu |

This queue is for tickets about the Math-Interpolator CPAN distribution.

Report information
The Basics
Id: 49799
Status: resolved
Priority: 0/
Queue: Math-Interpolator

People
Owner: Nobody in particular
Requestors: mnvl16 [...] yahoo.co.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Interpolation points not found correctly with non-integers
Date: Thu, 17 Sep 2009 22:38:04 +0000 (GMT)
To: bug-Math-Interpolator [...] rt.cpan.org
From: Jack Grahl <mnvl16 [...] yahoo.co.uk>
If we try to interpolate at a point which is not an integer, currently we get either incorrect results, or we get an incorrect warning that we are trying to interpolate outside the known points when we are not The following patch should fix this problem --- /usr/lib/perl5/site_perl/5.8.8/Math/Interpolator.pm 2009-09-16 13:43:01.000000000 +0100 +++ Interpolator.pm 2009-09-17 23:18:14.000000000 +0100 @@ -118,8 +118,11 @@ my $max = @$self - 1; BINSEARCH: while($max != $min + 1) { + my $try; + { use integer; - my $try = ($min + $max) / 2; + $try = ($min + $max) / 2; + } if($x >= $self->[$try]->$x_method) { $min = $try; } else { As can be seen from the patch, the scope of the 'use integer' pragma is too big and encompasses the comparison operator in the 'if' condition. This leads to undesired results. Hope this helps, Jack Grahl
Fixed in Math-Interpolator-0.003, just uploaded to CPAN. Thank you for the bug report.