Skip Menu |

This queue is for tickets about the Algorithm-Points-MinimumDistance CPAN distribution.

Report information
The Basics
Id: 58263
Status: new
Priority: 0/
Queue: Algorithm-Points-MinimumDistance

People
Owner: Nobody in particular
Requestors: schreib [...] compugen.co.il
Cc:
AdminCc:

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



Subject: bug: assumes integer values
Date: Wed, 9 Jun 2010 10:22:34 +0300
To: <bug-Algorithm-Points-MinimumDistance [...] rt.cpan.org>
From: "Ehud Schreiber" <schreib [...] compugen.co.il>
Hi, The code as it stands has a bug, because it implicitly assumes that all the coordinates (and the boxsize parameter) are integers. This is because the determination of the box where a point resides is done using the modulus operator, as in line 94 (in sub box): my @box = map { $_ - ($_ % $self->{boxsize}) } @$point; meaning that values are first reduced to integers if they are floats. This gives the wrong results, and when the boxsize is small and reduced to zero, the module crashes (square brackets for variable output): Illegal modulus zero at [Algorithm/Points/MinimumDistance.pm] line 94, <STDIN> line []. Attempt to free unreferenced scalar: SV [], <STDIN> line []. Exit 255 This is a bug as the integrality demand is not clearly documented. Moreover, the integrality is not essential to the algorithm in any way - the above line can be changed to my @box = map { $self->{boxsize} * POSIX::floor($_/$self->{boxsize}) } @$point; I haven't checked, though, that correcting this line is the only change needed. Thanks, Ehud Schreiber.