From d6d56618dc4b964c7556244e794706b9414cd88c Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 18 May 2019 18:40:13 +0200 Subject: [PATCH] Add range test Add range test --- sonoff/support.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sonoff/support.ino b/sonoff/support.ino index 7c0bbb1a2..65ca62d7e 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -684,12 +684,13 @@ double TaylorLog(double x) { // https://stackoverflow.com/questions/46879166/finding-the-natural-logarithm-of-a-number-using-taylor-series-in-c + if (x <= 0.0) { return NAN; } double z = (x + 1) / (x - 1); // We start from power -1, to make sure we get the right power in each iteration; double step = ((x - 1) * (x - 1)) / ((x + 1) * (x + 1)); // Store step to not have to calculate it each time double totalValue = 0; double powe = 1; double y; - for (int count = 0; count < 10; count++) { + for (int count = 0; count < 10; count++) { // Experimental number of 10 iterations z *= step; y = (1 / powe) * z; totalValue = totalValue + y;