From a548c92eabdb38eacddafc2c4b83c963c453b03a Mon Sep 17 00:00:00 2001 From: Dima Pasechnik Date: Mon, 25 Feb 2019 12:30:30 +0000 Subject: [PATCH 1/3] bpo-36106: resolve sinpi name clash with libm (IEEE-754 violation) the standard math library (libm) may follow IEEE-754 recommendation to include an implementation of sinPi(), i.e. sinPi(x):=sin(pi*x). And this triggers a name clash, found by FreeBSD developer Steve Kargl, who worken on putting sinpi into libm used on FreeBSD (it has to be named "sinpi", not "sinPi", cf. e.g. https://en.cppreference.com/w/c/experimental/fpext4) --- Modules/mathmodule.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index 2272f622f0b9f6..fd0eb327c74329 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -100,7 +100,7 @@ static const double sqrtpi = 1.772453850905516027298167483341145182798; } static double -sinpi(double x) +m_sinpi(double x) { double y, r; int n; @@ -328,7 +328,7 @@ m_tgamma(double x) integer. */ if (absx > 200.0) { if (x < 0.0) { - return 0.0/sinpi(x); + return 0.0/m_sinpi(x); } else { errno = ERANGE; @@ -352,7 +352,7 @@ m_tgamma(double x) } z = z * lanczos_g / y; if (x < 0.0) { - r = -pi / sinpi(absx) / absx * exp(y) / lanczos_sum(absx); + r = -pi / m_sinpi(absx) / absx * exp(y) / lanczos_sum(absx); r -= z * r; if (absx < 140.0) { r /= pow(y, absx - 0.5); @@ -423,7 +423,7 @@ m_lgamma(double x) r += (absx - 0.5) * (log(absx + lanczos_g - 0.5) - 1); if (x < 0.0) /* Use reflection formula to get value for negative x. */ - r = logpi - log(fabs(sinpi(absx))) - log(absx) - r; + r = logpi - log(fabs(m_sinpi(absx))) - log(absx) - r; if (Py_IS_INFINITY(r)) errno = ERANGE; return r; From f8e90571cc622dd2898ba5e628101702307cc586 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" Date: Mon, 25 Feb 2019 13:21:44 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NEWS.d/next/Library/2019-02-25-13-21-43.bpo-36106.VuhEiQ.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2019-02-25-13-21-43.bpo-36106.VuhEiQ.rst diff --git a/Misc/NEWS.d/next/Library/2019-02-25-13-21-43.bpo-36106.VuhEiQ.rst b/Misc/NEWS.d/next/Library/2019-02-25-13-21-43.bpo-36106.VuhEiQ.rst new file mode 100644 index 00000000000000..9692c327292b3e --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-02-25-13-21-43.bpo-36106.VuhEiQ.rst @@ -0,0 +1 @@ +Resolve potential name clash with libm's sinpi() \ No newline at end of file From 24c5ff5092a2dd48be9471c330bf2603a1b158c5 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Mon, 25 Feb 2019 16:26:24 +0000 Subject: [PATCH 3/3] add my name Co-Authored-By: dimpase --- .../next/Library/2019-02-25-13-21-43.bpo-36106.VuhEiQ.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2019-02-25-13-21-43.bpo-36106.VuhEiQ.rst b/Misc/NEWS.d/next/Library/2019-02-25-13-21-43.bpo-36106.VuhEiQ.rst index 9692c327292b3e..36e17508cd4a0d 100644 --- a/Misc/NEWS.d/next/Library/2019-02-25-13-21-43.bpo-36106.VuhEiQ.rst +++ b/Misc/NEWS.d/next/Library/2019-02-25-13-21-43.bpo-36106.VuhEiQ.rst @@ -1 +1 @@ -Resolve potential name clash with libm's sinpi() \ No newline at end of file +Resolve potential name clash with libm's sinpi(). Patch by Dmitrii Pasechnik.