From 1025fd99377a375381156d7a3d1176a63ab1f2ae Mon Sep 17 00:00:00 2001 From: Hugo Saint-Vignes Date: Wed, 25 Nov 2020 11:41:05 +0100 Subject: [PATCH] [apps/regression] Use cmath for sin and cos functions Change-Id: I670eda49a73d9bf1d1d75194178344adda9b1014 --- apps/regression/model/trigonometric_model.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/regression/model/trigonometric_model.cpp b/apps/regression/model/trigonometric_model.cpp index a612f7978..37d9f225d 100644 --- a/apps/regression/model/trigonometric_model.cpp +++ b/apps/regression/model/trigonometric_model.cpp @@ -9,8 +9,8 @@ #include #include #include -#include #include +#include using namespace Poincare; using namespace Shared; @@ -43,7 +43,7 @@ double TrigonometricModel::evaluate(double * modelCoefficients, double x) const double d = modelCoefficients[3]; double radian = toRadians(Poincare::Preferences::sharedPreferences()->angleUnit()); // sin() is here defined for radians, so b*x+c are converted in radians. - return a * sin(radian * (b * x + c)) + d; + return a * std::sin(radian * (b * x + c)) + d; } double TrigonometricModel::partialDerivate(double * modelCoefficients, int derivateCoefficientIndex, double x) const { @@ -60,15 +60,15 @@ double TrigonometricModel::partialDerivate(double * modelCoefficients, int deriv * radians. The added coefficient also appear in derivatives. */ if (derivateCoefficientIndex == 0) { // Derivate with respect to a: sin(b*x+c) - return sin(radian * (b * x + c)); + return std::sin(radian * (b * x + c)); } if (derivateCoefficientIndex == 1) { // Derivate with respect to b: x*a*cos(b*x+c); - return radian * x * a * cos(radian * (b * x + c)); + return radian * x * a * std::cos(radian * (b * x + c)); } assert(derivateCoefficientIndex == 2); // Derivate with respect to c: a*cos(b*x+c) - return radian * a * cos(radian * (b * x + c)); + return radian * a * std::cos(radian * (b * x + c)); } void TrigonometricModel::specializedInitCoefficientsForFit(double * modelCoefficients, double defaultValue, Store * store, int series) const {