From 28ea4871dc6607d755a67b5a24116de2d8d1c5d4 Mon Sep 17 00:00:00 2001 From: neingeist Date: Fri, 14 Feb 2014 21:31:38 +0100 Subject: [PATCH] Assert that we have n>=2 samples --- av-variance.c | 1 + 1 file changed, 1 insertion(+) diff --git a/av-variance.c b/av-variance.c index bc314aa..4c6cb50 100644 --- a/av-variance.c +++ b/av-variance.c @@ -27,6 +27,7 @@ double sample_variance(double set[], int set_n) { } // Divide by (n-1), as this is *sample* variance (Bessel's correction). + assert(set_n>1); ss /= (set_n-1); return ss;