Subject: | Bug in freq distribution |
Date: | Mon, 14 Apr 2008 12:39:48 +0200 |
To: | bug-Statistics-Descriptive [...] rt.cpan.org |
From: | andres.caceresvelilla [...] telefonica.es |
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
___________________________________________________________________________
Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si no es vd. el destinatario
indicado, queda notificado de que la lectura, utilización, divulgación y/o
copia sin autorización está prohibida en virtud de la legislación vigente.
Si ha recibido este mensaje por error, le rogamos que nos lo comunique
inmediatamente por esta misma vía y proceda a su destrucción.
El correo electrónico vía Internet no permite asegurar la confidencialidad
de los mensajes que se transmiten ni su integridad o correcta recepción.
Telefónica no asume ninguna responsabilidad por estas circunstancias.
This message is intended exclusively for its addressee and may contain
information that is CONFIDENTIAL and protected by a professional privilege
or whose disclosure is prohibited by law.If you are not the intended
recipient you are hereby notified that any read, dissemination, copy or
disclosure of this communication is strictly prohibited by law. If this
message has been received in error, please immediately notify us via e-mail
and delete it.
Internet e-mail neither guarantees the confidentiality nor the integrity or
proper receipt of the messages sent. Telefónica does not assume any
liability for those circumstances.
___________________________________________________________________________
Message body is not shown because sender requested not to inline it.