Hello, thanks for your attention and sorry for my English!
I do not know whether this has been reported before. I get this error on a
Win32 perl 5.8.3 and I guess it's related with precission (see the code
generated output).
Please test this. Test data is included.
(See attached file: bugdistfreq.pl)
I get 21 partitions and I should get 20.
This is probably the partition limit to blame: 784.999999999999 . Too close
to the max value (785).
And this may be the piece of code that makes it go mad. Somehow, testing
"($iter+= $interval) < $self->{max} " is not robust enough so it performs
an additional iteration (1 more iteration than partitions).
return undef unless $partitions >= 1;
my $interval = $self->{sample_range}/$partitions;
my $iter = $self->{min};
while (($iter += $interval) < $self->{max}) {
$bins{$iter} = 0;
push @k, $iter; ##Keep the "keys" unstringified
}
$bins{$self->{max}} = 0;
push @k, $self->{max};
I think you may solve it by controlling the number of iterations so if you
have performed one extra iteration, you just pop the last value and add it
to the new last value.
Another smarter way to solve it is always assigning the max value to the
last partition.
Thanks a lot for your module, I love it.
Show quoted text

Hi!
Thanks for your bug report. I am not the originator or the PAUSE-blessed
current maintainer of the module, but I have a development branch for it
here:
http://svn.berlios.de/svnroot/repos/web-cpan/Statistics-Descriptive/
I adapted your script to a test script in the trunk and I fixed it in
revision 3528.
Thank you, again!
Regards,
Shlomi Fish
On Mon Apr 14 06:41:08 2008, andres.caceresvelilla@telefonica.es wrote:
Show quoted text

>
>
> Hello, thanks for your attention and sorry for my English!
>
> I do not know whether this has been reported before. I get this error on a
> Win32 perl 5.8.3 and I guess it's related with precission (see the code
> generated output).
>
> Please test this. Test data is included.
> (See attached file: bugdistfreq.pl)
>
> I get 21 partitions and I should get 20.
>
> This is probably the partition limit to blame: 784.999999999999 . Too

close
Show quoted text

> to the max value (785).
>
> And this may be the piece of code that makes it go mad. Somehow, testing
> "($iter+= $interval) < $self->{max} " is not robust enough so it performs
> an additional iteration (1 more iteration than partitions).
>
> return undef unless $partitions >= 1;
> my $interval = $self->{sample_range}/$partitions;
> my $iter = $self->{min};
> while (($iter += $interval) < $self->{max}) {
> $bins{$iter} = 0;
> push @k, $iter; ##Keep the "keys" unstringified
> }
> $bins{$self->{max}} = 0;
> push @k, $self->{max};
>
>
> I think you may solve it by controlling the number of iterations so if you
> have performed one extra iteration, you just pop the last value and add it
> to the new last value.
>
> Another smarter way to solve it is always assigning the max value to the
> last partition.
>
> Thanks a lot for your module, I love it.
>
>