diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-02-25 23:10:54 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-25 23:10:54 -0800 |
commit | 4e6646fef5d2cc53422e4eca0b18201ed5a5c4b6 (patch) | |
tree | 37efa7fab70e4e02b4821c5c06f8a2ab3f3fb5cd /Modules | |
parent | 0395869c8c3dbf48ba2db48bcc78aa7e2086be32 (diff) | |
download | cpython-git-4e6646fef5d2cc53422e4eca0b18201ed5a5c4b6.tar.gz |
bpo-36106: Resolve sinpi name clash with libm (IEEE-754 violation). (GH-12027)
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).
(cherry picked from commit f57cd8288dbe6aba99c057f37ad6d58f8db75350)
Co-authored-by: Dima Pasechnik <dimpase@gmail.com>
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/mathmodule.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index 5d9fe5aa71..9eaeff1159 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -77,7 +77,7 @@ static const double sqrtpi = 1.772453850905516027298167483341145182798; #endif /* !defined(HAVE_ERF) || !defined(HAVE_ERFC) */ static double -sinpi(double x) +m_sinpi(double x) { double y, r; int n; @@ -305,7 +305,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; @@ -329,7 +329,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); @@ -400,7 +400,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; |