FREQUENCIES: Fix bug when combining HISTOGRAM with PERCENTILES.
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 5 Dec 2014 10:53:13 +0000 (11:53 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 5 Dec 2014 10:53:13 +0000 (11:53 +0100)
This bug was reported only on windows, but had the potential to
affect any system.

Thanks to "Dr. Yaron Ghilay" <gy21@inter.net.il> for reporting
the bug, and to Kai.Borgolte@gmx.de for diagnosing it.

src/language/stats/frequencies.c

index b2253e311d11341e9626b5f8d7541bd0ab1eb062..17e03130923bab5888580f0493d39f8decd712e3 100644 (file)
@@ -82,6 +82,14 @@ ptile_3way (const void *_p1, const void *_p2)
   if (p1->p < p2->p)
     return -1;
 
+  if (p1->p == p2->p)
+    {
+      if (p1->show > p2->show)
+       return -1;
+
+      return (p1->show < p2->show);
+    }
+
   return (p1->p > p2->p);
 }