]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/lock: fix stdDev
authorVMware, Inc <>
Thu, 24 Feb 2011 21:28:10 +0000 (13:28 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 24 Feb 2011 21:28:10 +0000 (13:28 -0800)
The standard deviation computation is incorrect when then
there are multiple observations and they are all 0.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/lock/ulStats.c

index 98963ad4f6697c319d4bf5382dfa50cf180c25e1..2bc66e1082ec0a95608fe3c4114fa5a614016659 100644 (file)
@@ -538,6 +538,10 @@ MXUserSqrt(double x)  // IN: hack until next round when FP goes away
    double xn;
    double xn1 = x;
 
+   if (x == 0.0) {
+      return 0.0;
+   }
+
    do {
       xn = xn1;
       xn1 = (xn + x/xn) / 2.0;