diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-18 17:43:46 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-19 09:59:43 +0100 |
commit | 37429f2690a96491ad0e4fa2a04f2fa88a66da87 (patch) | |
tree | 9963c1f531f22306edaf2ce8b41d5636f5e191f3 /sc | |
parent | 0afd2d3bfa9d55249ffd1408681ff04decf2d8fa (diff) |
Use M_PI* instead of F_PI*
Change-Id: Ie2b7a1c74fc516781a17a20157b8217bc41e383d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125504
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/opencl/opinlinefun_statistical.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/interpr3.cxx | 14 | ||||
-rw-r--r-- | sc/source/filter/excel/xeformula.cxx | 2 |
4 files changed, 12 insertions, 12 deletions
diff --git a/sc/source/core/opencl/opinlinefun_statistical.cxx b/sc/source/core/opencl/opinlinefun_statistical.cxx index dfed055a9b44..6988ff7f03e8 100644 --- a/sc/source/core/opencl/opinlinefun_statistical.cxx +++ b/sc/source/core/opencl/opinlinefun_statistical.cxx @@ -10,7 +10,7 @@ #ifndef SC_OPENCL_OPINLINFUN_statistical #define SC_OPENCL_OPINLINFUN_statistical std::string MinDecl = "#define Min 2.22507e-308\n"; -std::string F_PIDecl="#define F_PI 3.1415926\n"; +std::string F_PIDecl="#define M_PI 3.1415926\n"; std::string fBigInvDecl ="#define fBigInv 2.22045e-016\n"; std::string fMachEpsDecl ="#define fMachEps 2.22045e-016\n"; std::string fLogDblMaxDecl ="#define fLogDblMax log(1.79769e+308)\n"; @@ -406,7 +406,7 @@ std::string GetChiSqDistPDF = " }\n" " else\n" " {\n" -" fValue = pow(sqrt(fX*2*F_PI),-1.0);\n" +" fValue = pow(sqrt(fX*2*M_PI),-1.0);\n" " fCount = 1.0;\n" " }\n" " while ( fCount < fDF)\n" diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index bd4a37d85742..4e1471c46fbc 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -1725,7 +1725,7 @@ void ScInterpreter::ScBitRshift() void ScInterpreter::ScPi() { - PushDouble(F_PI); + PushDouble(M_PI); } void ScInterpreter::ScRandomImpl( const std::function<double( double fFirst, double fLast )>& RandomFunc, @@ -1869,7 +1869,7 @@ void ScInterpreter::ScArcTan() void ScInterpreter::ScArcCot() { - PushDouble((F_PI2) - atan(GetDouble())); + PushDouble((M_PI_2) - atan(GetDouble())); } void ScInterpreter::ScSinHyp() diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index c2c91f621bfd..8d7ba5ea4952 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -585,7 +585,7 @@ static double lcl_GetLogGammaHelper(double fZ) /** You must ensure non integer arguments for fZ<1 */ double ScInterpreter::GetGamma(double fZ) { - const double fLogPi = log(F_PI); + const double fLogPi = log(M_PI); const double fLogDblMax = log( ::std::numeric_limits<double>::max()); if (fZ > fMaxGammaArgument) @@ -612,7 +612,7 @@ double ScInterpreter::GetGamma(double fZ) } // fZ<-0.5 // Use Euler's reflection formula: gamma(x)= pi/ ( gamma(1-x)*sin(pi*x) ) - double fLogDivisor = lcl_GetLogGammaHelper(1-fZ) + log( std::abs( ::rtl::math::sin( F_PI*fZ))); + double fLogDivisor = lcl_GetLogGammaHelper(1-fZ) + log( std::abs( ::rtl::math::sin( M_PI*fZ))); if (fLogDivisor - fLogPi >= fLogDblMax) // underflow return 0.0; @@ -623,7 +623,7 @@ double ScInterpreter::GetGamma(double fZ) return HUGE_VAL; } - return exp( fLogPi - fLogDivisor) * ((::rtl::math::sin( F_PI*fZ) < 0.0) ? -1.0 : 1.0); + return exp( fLogPi - fLogDivisor) * ((::rtl::math::sin( M_PI*fZ) < 0.0) ? -1.0 : 1.0); } /** You must ensure fZ>0 */ @@ -709,7 +709,7 @@ double ScInterpreter::GetChiSqDistPDF(double fX, double fDF) } else { - fValue = 1/sqrt(fX*2*F_PI); + fValue = 1/sqrt(fX*2*M_PI); fCount = 1.0; } while ( fCount < fDF) @@ -1610,7 +1610,7 @@ void ScInterpreter::ScStdNormDist_MS() if ( bCumulative ) PushDouble( integralPhi( x ) ); else - PushDouble( exp( - pow( x, 2 ) / 2 ) / sqrt( 2 * F_PI ) ); + PushDouble( exp( - pow( x, 2 ) / 2 ) / sqrt( 2 * M_PI ) ); } void ScInterpreter::ScExpDist() @@ -4849,7 +4849,7 @@ void ScTwiddleFactors::Compute() mfWReal.resize(mnN); mfWImag.resize(mnN); - double nW = (mbInverse ? 2 : -2)*F_PI/static_cast<double>(mnN); + double nW = (mbInverse ? 2 : -2)*M_PI/static_cast<double>(mnN); if (mnN == 1) { @@ -5189,7 +5189,7 @@ void ScComplexBluesteinFFT::Compute() { std::vector<double> aRealScalars(mnPoints); std::vector<double> aImagScalars(mnPoints); - double fW = (mbInverse ? 2 : -2)*F_PI/static_cast<double>(mnPoints); + double fW = (mbInverse ? 2 : -2)*M_PI/static_cast<double>(mnPoints); for (SCSIZE nIdx = 0; nIdx < mnPoints; ++nIdx) { double fAngle = 0.5*fW*static_cast<double>(nIdx*nIdx); diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index 982143d877c4..e4e3ec402e89 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -1453,7 +1453,7 @@ void XclExpFmlaCompImpl::PrepareFunction( const XclExpFuncData& rFuncData ) AppendIntToken( 1 ); break; case ocArcCot: // simulate ACOT(x) by (PI/2-ATAN(x)) - AppendNumToken( F_PI2 ); + AppendNumToken( M_PI_2 ); break; default:; } |