summaryrefslogtreecommitdiffstats
path: root/storperf/utilities/math.py
diff options
context:
space:
mode:
Diffstat (limited to 'storperf/utilities/math.py')
-rw-r--r--storperf/utilities/math.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/storperf/utilities/math.py b/storperf/utilities/math.py
index a11ec19..4ddddca 100644
--- a/storperf/utilities/math.py
+++ b/storperf/utilities/math.py
@@ -52,8 +52,11 @@ def slope(data_series):
sum_yi_xi += xi * yi
sum_yi += yi
- beta2 = (sum_yi * sum_xi - m * sum_yi_xi) / \
- (sum_xi**2 - m * sum_xi_sq) # The slope
+ over = (sum_xi**2 - m * sum_xi_sq)
+ if over == 0:
+ beta2 = None # Infinite slope
+ else:
+ beta2 = (sum_yi * sum_xi - m * sum_yi_xi) / over # The slope
# beta1 = (sum_yi_xi - beta2*sum_xi_sq)/sum_xi #The y-intercept if
# needed