use strict;
use warnings;
use Statistics::Descriptive;
use 5.012;
my @data = ( -2, 7, 7, 4, 18, -5 );
my $stat = Statistics::Descriptive::Full->new();
$stat->add_data(@data);
say ($stat->percentile(100) // "undef"); # return 18. OK.
say ($stat->percentile(0) // "undef"); # return undef instead of "-inf". see doc below
use strict; use warnings; use Statistics::Descriptive; use 5.012; my @data = ( -2, 7,
Share
Same outcome on ActiveState 5.12.2 64-bit on a Windows platform. You answered your own question: it does not work as documented.
returns
0Edit : as rafl points out, on a Windows system
perl -e "print(9**9**9);"will give1.#INFinstead ofinf. Asinfapparently isn’t implemented yet in my version, the Statistics package won’t be able to returninfand returns undefined instead.Edit2 : As it turns out OP works on Linux and can return
inf, the error is probably inherent to theStatistics::Descriptivepackage.