Date: Sun, 18 Jun 2017 11:31:12 -0700 From: Steve Kargl <sgk@troutmask.apl.washington.edu> To: freebsd-ports@freebsd.org, python@FreeBSD.org Subject: Re: [PATCH] lang/python27 -- Fix namespace collision Message-ID: <20170618183112.GA67920@troutmask.apl.washington.edu> In-Reply-To: <20170618182905.GA67867@troutmask.apl.washington.edu> References: <20170618182905.GA67867@troutmask.apl.washington.edu>
index | next in thread | previous in thread | raw e-mail
On Sun, Jun 18, 2017 at 11:29:05AM -0700, Steve Kargl wrote:
> Both IEEE-754 2008 and ISO/IEC TS 18661-4 define the half-cycle
> trignometric functions cospi, sinpi, and tanpi. When libm (aka
> math.h) grows support for sinpi(x), lang/python27 has a namespace
> collision. The attached patch fixes the problem.
>
Well, that's inconvenient. Seems attachments are stripped.
--- Modules/mathmodule.c.orig 2017-06-18 11:09:05.938222000 -0700
+++ Modules/mathmodule.c 2017-06-18 11:09:56.248307000 -0700
@@ -71,7 +71,7 @@
static const double sqrtpi = 1.772453850905516027298167483341145182798;
static double
-sinpi(double x)
+my_sinpi(double x)
{
double y, r;
int n;
@@ -270,7 +270,7 @@
integer. */
if (absx > 200.0) {
if (x < 0.0) {
- return 0.0/sinpi(x);
+ return 0.0/my_sinpi(x);
}
else {
errno = ERANGE;
@@ -294,7 +294,7 @@
}
z = z * lanczos_g / y;
if (x < 0.0) {
- r = -pi / sinpi(absx) / absx * exp(y) / lanczos_sum(absx);
+ r = -pi / my_sinpi(absx) / absx * exp(y) / lanczos_sum(absx);
r -= z * r;
if (absx < 140.0) {
r /= pow(y, absx - 0.5);
@@ -366,7 +366,7 @@
(x-0.5)*(log(x+lanczos_g-0.5)-1);
}
else {
- r = log(pi) - log(fabs(sinpi(absx))) - log(absx) -
+ r = log(pi) - log(fabs(my_sinpi(absx))) - log(absx) -
(log(lanczos_sum(absx)) - lanczos_g +
(absx-0.5)*(log(absx+lanczos_g-0.5)-1));
}
--
Steve
20170425 https://www.youtube.com/watch?v=VWUpyCsUKR4
20161221 https://www.youtube.com/watch?v=IbCHE-hONow
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170618183112.GA67920>
