From 52af702c887d7fcdddaa2ae39026083258360a20 Mon Sep 17 00:00:00 2001 From: Alejandro Baranek Date: Mon, 29 Apr 2024 15:26:14 -0300 Subject: [PATCH 1/3] Update geometric.hpp The proposal is derived from this issue https://github.com/boostorg/math/issues/1126 --- include/boost/math/distributions/geometric.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/math/distributions/geometric.hpp b/include/boost/math/distributions/geometric.hpp index baff0e249f..876d6a1761 100644 --- a/include/boost/math/distributions/geometric.hpp +++ b/include/boost/math/distributions/geometric.hpp @@ -401,7 +401,7 @@ namespace boost } if(k == 0) { - return log(p); // success_fraction + return std::log(p); // success_fraction } //RealType q = 1 - p; // Bad for small p //RealType probability = 1 - std::pow(q, k+1); From 419f44ada1ad58d86ec62bfa655e765a041ea982 Mon Sep 17 00:00:00 2001 From: Alejandro Baranek Date: Mon, 29 Apr 2024 17:10:33 -0300 Subject: [PATCH 2/3] Update geometric.hpp Implemented suggested change in https://github.com/boostorg/math/pull/1127#pullrequestreview-2029296711 --- include/boost/math/distributions/geometric.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/boost/math/distributions/geometric.hpp b/include/boost/math/distributions/geometric.hpp index 876d6a1761..c4648d04ff 100644 --- a/include/boost/math/distributions/geometric.hpp +++ b/include/boost/math/distributions/geometric.hpp @@ -384,6 +384,7 @@ namespace boost inline RealType logcdf(const geometric_distribution& dist, const RealType& k) { // Cumulative Distribution Function of geometric. using std::pow; + using std::log; static const char* function = "boost::math::logcdf(const geometric_distribution<%1%>&, %1%)"; // k argument may be integral, signed, or unsigned, or floating point. @@ -401,7 +402,7 @@ namespace boost } if(k == 0) { - return std::log(p); // success_fraction + return log(p); // success_fraction } //RealType q = 1 - p; // Bad for small p //RealType probability = 1 - std::pow(q, k+1); From 13037863715683832b98e4db846b7b0b40481b8b Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Tue, 30 Apr 2024 08:18:36 +0200 Subject: [PATCH 3/3] Update include/boost/math/distributions/geometric.hpp --- include/boost/math/distributions/geometric.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/math/distributions/geometric.hpp b/include/boost/math/distributions/geometric.hpp index c4648d04ff..7c511ef2db 100644 --- a/include/boost/math/distributions/geometric.hpp +++ b/include/boost/math/distributions/geometric.hpp @@ -385,6 +385,7 @@ namespace boost { // Cumulative Distribution Function of geometric. using std::pow; using std::log; + using std::exp; static const char* function = "boost::math::logcdf(const geometric_distribution<%1%>&, %1%)"; // k argument may be integral, signed, or unsigned, or floating point.