summaryrefslogtreecommitdiff
path: root/connectivity/source
diff options
context:
space:
mode:
authorpragat-pandya <pragat.pandya@gmail.com>2022-02-01 05:59:42 +0530
committerHossein <hossein@libreoffice.org>2022-02-15 12:17:50 +0100
commit5f21eaa0e6b689233336cacc949b9a55d545088f (patch)
treea0f892e0c3a1b738c3e59e934a48b326891714ca /connectivity/source
parent22d09d65c0e61cac1fa27af6a04a23e16f97c907 (diff)
tdf#145759 Using M_PI from cmath instead of magic constants.
Replace the instances of Pi's value as magic number by M_PI Use M_PI_2 and 2_M_PI instead of calculating these values in code. Use basegfx functions to convert angle units. Change-Id: I6cca7cc93704a70ccf3a0571a56a789bc9df51ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129479 Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com> Reviewed-by: Hossein <hossein@libreoffice.org> Tested-by: Jenkins
Diffstat (limited to 'connectivity/source')
-rw-r--r--connectivity/source/drivers/file/FNumericFunctions.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/connectivity/source/drivers/file/FNumericFunctions.cxx b/connectivity/source/drivers/file/FNumericFunctions.cxx
index 7de058dee06c..7c7fdc75425f 100644
--- a/connectivity/source/drivers/file/FNumericFunctions.cxx
+++ b/connectivity/source/drivers/file/FNumericFunctions.cxx
@@ -19,14 +19,13 @@
#include <cmath>
+#include <basegfx/numeric/ftools.hxx>
#include <file/FNumericFunctions.hxx>
#include <rtl/math.hxx>
using namespace connectivity;
using namespace connectivity::file;
-const double fPi = 3.14159265358979323846;
-
ORowSetValue OOp_Abs::operate(const ORowSetValue& lhs) const
{
if ( lhs.isNull() )
@@ -162,7 +161,7 @@ ORowSetValue OOp_Sqrt::operate(const ORowSetValue& lhs) const
ORowSetValue OOp_Pi::operate(const std::vector<ORowSetValue>& /*lhs*/) const
{
- return fPi;
+ return M_PI;
}
ORowSetValue OOp_Cos::operate(const ORowSetValue& lhs) const
@@ -227,7 +226,7 @@ ORowSetValue OOp_Degrees::operate(const ORowSetValue& lhs) const
return lhs;
double nLhs = lhs.getDouble();
- return nLhs*180*(1.0/fPi);
+ return basegfx::rad2deg(nLhs);
}
ORowSetValue OOp_Radians::operate(const ORowSetValue& lhs) const
@@ -236,7 +235,7 @@ ORowSetValue OOp_Radians::operate(const ORowSetValue& lhs) const
return lhs;
double nLhs = lhs.getDouble();
- return nLhs*fPi*(1.0/180.0);
+ return basegfx::deg2rad(nLhs);
}