From 92efe4450b040a610cd8ef60fd99159f1b3ebec0 Mon Sep 17 00:00:00 2001 From: Alejandro Martinez Date: Tue, 3 Nov 2015 20:57:37 -0300 Subject: [PATCH] Fixed use of abs instead of fabs Some compilers choose the integer version when scope is not explicit, changed to fabs for clarity sake. --- src/GOVSS.cpp | 2 +- src/VDOTCalculator.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GOVSS.cpp b/src/GOVSS.cpp index 32590028f..50465bb20 100644 --- a/src/GOVSS.cpp +++ b/src/GOVSS.cpp @@ -222,7 +222,7 @@ class XPace : public RideMetric { else do { speed = (low + high)/2.0; double watts = running_power(weight, height, speed); - if (abs(watts - lnp_watts) < 0.001) break; + if (fabs(watts - lnp_watts) < 0.001) break; else if (watts < lnp_watts) low = speed; else if (watts > lnp_watts) high = speed; } while (high - low > 0.01); diff --git a/src/VDOTCalculator.cpp b/src/VDOTCalculator.cpp index 54466b57b..ea72d409e 100644 --- a/src/VDOTCalculator.cpp +++ b/src/VDOTCalculator.cpp @@ -60,7 +60,7 @@ VDOTCalculator::eqvTime(double VDOT, double dist) fprime_t = ((0.2989558*exp(-0.1932605*t) + 0.1894393*exp(-0.012778*t) + 0.8)*(-0.000208*pow(dist, 2)*pow(t,-3) - 0.182258*dist*pow(t, -2)) - ((0.000104*pow(dist, 2)*pow(t, -2) + 0.182258*dist*pow(t, -1) -4.6) * (-0.1932605*0.2989558*exp( -0.1932605*t) + -0.012778*0.1894393*exp(-0.012778*t)))) / pow(0.2989558*exp(-0.1932605*t) + 0.1894393*exp(-0.012778*t) + 0.8, 2); t -= f_t/fprime_t; iter--; - } while (abs(f_t/fprime_t) > 1e-3 && iter > 0); + } while (fabs(f_t/fprime_t) > 1e-3 && iter > 0); return t; }