r35374 - in /trunk/libstatistics-descriptive-perl: Changes MANIFEST META.yml debian/changelog examples/ lib/Statistics/Descriptive.pm t/descr.t

ryan52-guest at users.alioth.debian.org ryan52-guest at users.alioth.debian.org
Thu May 14 00:36:59 UTC 2009


Author: ryan52-guest
Date: Thu May 14 00:36:54 2009
New Revision: 35374

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=35374
Log:
New upstream release

Added:
    trunk/libstatistics-descriptive-perl/examples/
      - copied from r35373, branches/upstream/libstatistics-descriptive-perl/current/examples/
Modified:
    trunk/libstatistics-descriptive-perl/Changes
    trunk/libstatistics-descriptive-perl/MANIFEST
    trunk/libstatistics-descriptive-perl/META.yml
    trunk/libstatistics-descriptive-perl/debian/changelog
    trunk/libstatistics-descriptive-perl/lib/Statistics/Descriptive.pm
    trunk/libstatistics-descriptive-perl/t/descr.t

Modified: trunk/libstatistics-descriptive-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstatistics-descriptive-perl/Changes?rev=35374&op=diff
==============================================================================
--- trunk/libstatistics-descriptive-perl/Changes (original)
+++ trunk/libstatistics-descriptive-perl/Changes Thu May 14 00:36:54 2009
@@ -1,4 +1,10 @@
 Revision history for Perl extension Statistics::Descriptive.
+
+    - Fixed bug https://rt.cpan.org/Public/Bug/Display.html?id=46026 :
+        - standard_deviation failing due to a variance that got evaluated
+        to 0 due to rounding errors.
+    - Kwalitee : added a LICENSE section to the POD.
+    - Kwalitee (CPANTS) : added an examples/ directory with a script.
 
 2.8   May 09, 2009
 

Modified: trunk/libstatistics-descriptive-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstatistics-descriptive-perl/MANIFEST?rev=35374&op=diff
==============================================================================
--- trunk/libstatistics-descriptive-perl/MANIFEST (original)
+++ trunk/libstatistics-descriptive-perl/MANIFEST Thu May 14 00:36:54 2009
@@ -1,5 +1,6 @@
 Build.PL
 Changes
+examples/statistical-analysis.pl
 inc/Test/Run/Builder.pm
 lib/Statistics/Descriptive.pm
 Makefile.PL

Modified: trunk/libstatistics-descriptive-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstatistics-descriptive-perl/META.yml?rev=35374&op=diff
==============================================================================
--- trunk/libstatistics-descriptive-perl/META.yml (original)
+++ trunk/libstatistics-descriptive-perl/META.yml Thu May 14 00:36:54 2009
@@ -1,6 +1,6 @@
 ---
 name: Statistics-Descriptive
-version: 2.8
+version: 2.9
 author:
   - 'Shlomi Fish <shlomif at iglu.org.il>'
 abstract: Module of basic descriptive statistical functions.
@@ -22,7 +22,7 @@
 provides:
   Statistics::Descriptive:
     file: lib/Statistics/Descriptive.pm
-    version: 2.8
+    version: 2.9
   Statistics::Descriptive::Full:
     file: lib/Statistics/Descriptive.pm
   Statistics::Descriptive::Sparse:

Modified: trunk/libstatistics-descriptive-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstatistics-descriptive-perl/debian/changelog?rev=35374&op=diff
==============================================================================
--- trunk/libstatistics-descriptive-perl/debian/changelog (original)
+++ trunk/libstatistics-descriptive-perl/debian/changelog Thu May 14 00:36:54 2009
@@ -1,10 +1,11 @@
-libstatistics-descriptive-perl (2.8-1) UNRELEASED; urgency=low
+libstatistics-descriptive-perl (2.9-1) UNRELEASED; urgency=low
 
   no need to upload
 
   * New upstream release
+  * New upstream release
 
- -- Ryan Niebur <ryanryan52 at gmail.com>  Sat, 09 May 2009 15:27:39 -0700
+ -- Ryan Niebur <ryanryan52 at gmail.com>  Wed, 13 May 2009 17:36:45 -0700
 
 libstatistics-descriptive-perl (2.7-1) unstable; urgency=low
 

Modified: trunk/libstatistics-descriptive-perl/lib/Statistics/Descriptive.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstatistics-descriptive-perl/lib/Statistics/Descriptive.pm?rev=35374&op=diff
==============================================================================
--- trunk/libstatistics-descriptive-perl/lib/Statistics/Descriptive.pm (original)
+++ trunk/libstatistics-descriptive-perl/lib/Statistics/Descriptive.pm Thu May 14 00:36:54 2009
@@ -10,7 +10,7 @@
 		  ##Perl5.  01-03 weren't bug free.
 use vars (qw($VERSION $Tolerance));
 
-$VERSION = '2.8';
+$VERSION = '2.9';
 
 $Tolerance = 0.0;
 
@@ -117,7 +117,20 @@
   my $variance = $self->{variance};
   if (!defined($variance)) {
     $variance = ($self->{sumsq} - $count * $self->{mean}**2);
+
+    # Sometimes due to rounding errors we get a number below 0.
+    # This makes sure this is handled as gracefully as possible.
+    #
+    # See:
+    #
+    # https://rt.cpan.org/Public/Bug/Display.html?id=46026
+    if ($variance < 0)
+    {
+        $variance = 0;
+    }
+
     $variance /= $count - $div;
+
     $self->{variance} = $variance;
   }
   return $variance;
@@ -857,6 +870,11 @@
 reserved.  This program is free software; you can redistribute it
 and/or modify it under the same terms as Perl itself.
 
+=head1 LICENSE
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
 =head1 REVISION HISTORY
 
 =over 4

Modified: trunk/libstatistics-descriptive-perl/t/descr.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstatistics-descriptive-perl/t/descr.t?rev=35374&op=diff
==============================================================================
--- trunk/libstatistics-descriptive-perl/t/descr.t (original)
+++ trunk/libstatistics-descriptive-perl/t/descr.t Thu May 14 00:36:54 2009
@@ -3,8 +3,7 @@
 use strict;
 use warnings;
 
-# Should be 14.
-use Test::More tests => 14;
+use Test::More tests => 16;
 
 use Benchmark;
 use Statistics::Descriptive;
@@ -61,6 +60,20 @@
 
     ok($success, $blurb);
 }
+
+sub is_between
+{
+    local $Test::Builder::Level = $Test::Builder::Level + 1;
+    
+    my ($have, $want_bottom, $want_top, $blurb) = @_;
+
+    ok (
+        (($have >= $want_bottom) &&
+        ($want_top >= $have)),
+        $blurb
+    );
+}
+
 # print "1..14\n";
 
 # test #1
@@ -239,3 +252,24 @@
 ok ($t[1] < $t[0],
     "trimmed_mean caching works",
 );
+
+{
+    my $stat = Statistics::Descriptive::Full->new();
+
+    $stat->add_data((0.001) x 6);
+
+    # TEST
+    is_between ($stat->variance(),
+        0,
+        0.00001,
+        "Workaround to avoid rounding errors that yield negative variance."
+    );
+
+    # TEST
+    is_between ($stat->standard_deviation(),
+        0,
+        0.00001,
+        "Workaround to avoid rounding errors that yield negative std-dev."
+    );
+}
+




More information about the Pkg-perl-cvs-commits mailing list