This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit e3e520e948524d65994f7a3abb170433fe6eba15
Author: Pedro F. Giffuni <[email protected]>
AuthorDate: Tue Aug 25 23:51:58 2026 -0500

    Calc: Replace some uses of Boost math functions for their C++ counterparts.
    
    For the cases of acosh, asinh, atanh, expm1 and log1p we were making use
    of the Boost library which was/is available and of good quality. Nowadays
    these are included in all reasonable standard C++ libraries and it makes
    sense to use them for consistency.
---
 main/sc/source/core/tool/interpr1.cxx | 10 ++++------
 main/sc/source/core/tool/interpr2.cxx | 11 +++++------
 main/sc/source/core/tool/interpr3.cxx | 22 ++++++++++------------
 3 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/main/sc/source/core/tool/interpr1.cxx 
b/main/sc/source/core/tool/interpr1.cxx
index 74ee0b8a94..51d7277357 100644
--- a/main/sc/source/core/tool/interpr1.cxx
+++ b/main/sc/source/core/tool/interpr1.cxx
@@ -72,9 +72,7 @@
 #include "doubleref.hxx"
 #include "queryparam.hxx"
 
-#include <boost/math/special_functions/acosh.hpp>
-#include <boost/math/special_functions/asinh.hpp>
-#include <boost/math/special_functions/atanh.hpp>
+#include <cmath>
 
 #define SC_DOUBLE_MAXVALUE  1.7e307
 
@@ -1811,7 +1809,7 @@ void ScInterpreter::ScCotHyp()
 void ScInterpreter::ScArcSinHyp()
 {
     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", 
"ScInterpreter::ScArcSinHyp" );
-    PushDouble( ::boost::math::asinh( GetDouble()));
+    PushDouble( std::asinh( GetDouble()));
 }
 
 void ScInterpreter::ScArcCosHyp()
@@ -1821,7 +1819,7 @@ void ScInterpreter::ScArcCosHyp()
     if (fVal < 1.0)
         PushIllegalArgument();
     else
-        PushDouble( ::boost::math::acosh( fVal));
+        PushDouble( std::acosh( fVal));
 }
 
 void ScInterpreter::ScArcTanHyp()
@@ -1831,7 +1829,7 @@ void ScInterpreter::ScArcTanHyp()
     if (fabs(fVal) >= 1.0)
         PushIllegalArgument();
     else
-        PushDouble( ::boost::math::atanh( fVal));
+        PushDouble( std::atanh( fVal));
 }
 
 
diff --git a/main/sc/source/core/tool/interpr2.cxx 
b/main/sc/source/core/tool/interpr2.cxx
index bdeebb6938..a26b2d9872 100644
--- a/main/sc/source/core/tool/interpr2.cxx
+++ b/main/sc/source/core/tool/interpr2.cxx
@@ -50,8 +50,7 @@
 #include <string.h>
 #include <math.h>
 
-#include <boost/math/special_functions/expm1.hpp>
-#include <boost/math/special_functions/log1p.hpp>
+#include <cmath>
 
 using namespace formula;
 // STATIC DATA -----------------------------------------------------------
@@ -1136,11 +1135,11 @@ double ScInterpreter::ScGetRmz(double fRate, double 
fNper, double fPv,
     else
     {
         if (fPaytype > 0.0) // payment in advance
-            fPayment = (fFv + fPv * exp( fNper * ::boost::math::log1p(fRate) ) 
) * fRate /
-                (::boost::math::expm1( (fNper + 1) * 
::boost::math::log1p(fRate) ) - fRate);
+            fPayment = (fFv + fPv * exp( fNper * std::log1p(fRate) ) ) * fRate 
/
+                (std::expm1( (fNper + 1) * std::log1p(fRate) ) - fRate);
         else  // payment in arrear
-            fPayment = (fFv + fPv * exp(fNper * ::boost::math::log1p(fRate) ) 
) * fRate /
-                ::boost::math::expm1( fNper * ::boost::math::log1p(fRate) );
+            fPayment = (fFv + fPv * exp(fNper * std::log1p(fRate) ) ) * fRate /
+                std::expm1( fNper * std::log1p(fRate) );
     }
     return -fPayment;
 }
diff --git a/main/sc/source/core/tool/interpr3.cxx 
b/main/sc/source/core/tool/interpr3.cxx
index dfc05ef2c8..a1e3f3919e 100644
--- a/main/sc/source/core/tool/interpr3.cxx
+++ b/main/sc/source/core/tool/interpr3.cxx
@@ -44,9 +44,7 @@
 #include <vector>
 #include <algorithm>
 
-#include <boost/math/special_functions/atanh.hpp>
-#include <boost/math/special_functions/expm1.hpp>
-#include <boost/math/special_functions/log1p.hpp>
+#include <cmath>
 
 using ::std::vector;
 using namespace formula;
@@ -857,8 +855,8 @@ double ScInterpreter::GetBeta(double fAlpha, double fBeta)
     fLanczos *= sqrt((fABgm/(fA+fgm))/(fB+fgm));
     double fTempA = fB/(fA+fgm); // (fA+fgm)/fABgm = 1 / ( 1 + fB/(fA+fgm))
     double fTempB = fA/(fB+fgm);
-    double fResult = exp(-fA * ::boost::math::log1p(fTempA)
-                            -fB * ::boost::math::log1p(fTempB)-fgm);
+    double fResult = exp(-fA * std::log1p(fTempA)
+                            -fB * std::log1p(fTempB)-fgm);
     fResult *= fLanczos;
     return fResult;
 }
@@ -886,8 +884,8 @@ double ScInterpreter::GetLogBeta(double fAlpha, double 
fBeta)
     fLogLanczos += 0.5*(log(fABgm)-log(fA+fgm)-log(fB+fgm));
     double fTempA = fB/(fA+fgm); // (fA+fgm)/fABgm = 1 / ( 1 + fB/(fA+fgm))
     double fTempB = fA/(fB+fgm);
-    double fResult = -fA * ::boost::math::log1p(fTempA)
-                        -fB * ::boost::math::log1p(fTempB)-fgm;
+    double fResult = -fA * std::log1p(fTempA)
+                        -fB * std::log1p(fTempB)-fgm;
     fResult += fLogLanczos;
     return fResult;
 }
@@ -908,7 +906,7 @@ double ScInterpreter::GetBetaDistPDF(double fX, double fA, 
double fB)
             return HUGE_VAL;
         }
         if (fX <= 0.01)
-            return fB + fB * ::boost::math::expm1((fB-1.0) * 
::boost::math::log1p(-fX));
+            return fB + fB * std::expm1((fB-1.0) * std::log1p(-fX));
         else
             return fB * pow(0.5-fX+0.5,fB-1.0);
     }
@@ -947,7 +945,7 @@ double ScInterpreter::GetBetaDistPDF(double fX, double fA, 
double fB)
     // normal cases; result x^(a-1)*(1-x)^(b-1)/Beta(a,b)
     const double fLogDblMax = log( ::std::numeric_limits<double>::max());
     const double fLogDblMin = log( ::std::numeric_limits<double>::min());
-    double fLogY = (fX < 0.1) ? ::boost::math::log1p(-fX) : log(0.5-fX+0.5);
+    double fLogY = (fX < 0.1) ? std::log1p(-fX) : log(0.5-fX+0.5);
     double fLogX = log(fX);
     double fAm1LogX = (fA-1.0) * fLogX;
     double fBm1LogY = (fB-1.0) * fLogY;
@@ -1028,13 +1026,13 @@ double ScInterpreter::GetBetaDist(double fXin, double 
fAlpha, double fBeta)
         return pow(fXin, fAlpha);
     if (fAlpha == 1.0)
     //            1.0 - pow(1.0-fX,fBeta) is not accurate enough
-        return -::boost::math::expm1(fBeta * ::boost::math::log1p(-fXin));
+        return -std::expm1(fBeta * std::log1p(-fXin));
     //FIXME: need special algorithm for fX near fP for large fA,fB
     double fResult;
     // I use always continued fraction, power series are neither
     // faster nor more accurate.
     double fY = (0.5-fXin)+0.5;
-    double flnY = ::boost::math::log1p(-fXin);
+    double flnY = std::log1p(-fXin);
     double fX = fXin;
     double flnX = log(fXin);
     double fA = fAlpha;
@@ -1145,7 +1143,7 @@ void ScInterpreter::ScFisher()
     if (fabs(fVal) >= 1.0)
         PushIllegalArgument();
     else
-        PushDouble( ::boost::math::atanh( fVal));
+        PushDouble( std::atanh( fVal));
 }
 
 void ScInterpreter::ScFisherInv()

Reply via email to