From b0ce4e848f786a2f452a6a6e426df4b95af4da3c Mon Sep 17 00:00:00 2001 From: Hossein Date: Tue, 16 Nov 2021 12:56:49 +0100 Subject: Use basegfx::deg2rad instead of *0.01745329251994 * Replaced multiplying by magic number 0.01745329251994 with basegfx::deg2rad() which is equal to M_PI/180.0 * Instances of this could be found using: git grep 0.01745329251994 *.cxx *.hxx Change-Id: Ib813251f6223e4218fe977c0211732c22199295d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125294 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- i18npool/inc/calendar_hijri.hxx | 3 --- i18npool/source/calendar/calendar_hijri.cxx | 12 +++++------- 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'i18npool') diff --git a/i18npool/inc/calendar_hijri.hxx b/i18npool/inc/calendar_hijri.hxx index f8511842d6a7..9732ca373155 100644 --- a/i18npool/inc/calendar_hijri.hxx +++ b/i18npool/inc/calendar_hijri.hxx @@ -37,9 +37,6 @@ private: void mapToGregorian() override; void mapFromGregorian() override; - // radians per degree (pi/180) - static const double RadPerDeg; - // Synodic Period (mean time between 2 successive new moon: 29d, 12 hr, 44min, 3sec static const double SynPeriod; diff --git a/i18npool/source/calendar/calendar_hijri.cxx b/i18npool/source/calendar/calendar_hijri.cxx index 75a155104cbb..3bc6ccfa841d 100644 --- a/i18npool/source/calendar/calendar_hijri.cxx +++ b/i18npool/source/calendar/calendar_hijri.cxx @@ -24,6 +24,7 @@ #include #include +#include using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -36,9 +37,6 @@ namespace i18npool { // not used //static UErrorCode status; // status is shared in all calls to Calendar, it has to be reset for each call. -// radians per degree (pi/180) -const double Calendar_hijri::RadPerDeg = 0.01745329251994329577; - // Synodic Period (mean time between 2 successive new moon: 29d, 12 hr, 44min, 3sec const double Calendar_hijri::SynPeriod = 29.53058868; const double Calendar_hijri::SynMonth = 365.25/29.53058868; // Solar days in a year/SynPeriod @@ -128,22 +126,22 @@ Calendar_hijri::NewMoon(sal_Int32 n) + SynPeriod * k - 0.0001178 * t2 - 0.000000155 * t3 - + 0.00033 * sin(RadPerDeg * (166.56 + 132.87 * t - 0.009173 * t2)); + + 0.00033 * sin(basegfx::deg2rad(166.56 + 132.87 * t - 0.009173 * t2)); // Sun's mean anomaly in radian - sa = RadPerDeg * (359.2242 + sa = basegfx::deg2rad(359.2242 + 29.10535608 * k - 0.0000333 * t2 - 0.00000347 * t3); // Moon's mean anomaly - ma = RadPerDeg * (306.0253 + ma = basegfx::deg2rad(306.0253 + 385.81691806 * k + 0.0107306 * t2 + 0.00001236 * t3); // Moon's argument of latitude - tf = RadPerDeg * 2.0 * (21.2964 + tf = 2.0 * basegfx::deg2rad(21.2964 + 390.67050646 * k - 0.0016528 * t2 - 0.00000239 * t3); -- cgit