Fixed use of abs instead of fabs

Some compilers choose the integer version when scope is not explicit,
changed to fabs for clarity sake.
This commit is contained in:
Alejandro Martinez
2015-11-03 20:57:37 -03:00
parent 994eab95d2
commit 92efe4450b
2 changed files with 2 additions and 2 deletions

View File

@@ -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);

View File

@@ -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;
}