bool fail = data[i] > mean - numStdDev * stdDev; this should use Math.Abs(), but now you just count one side.