Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Apr 2019 12:56:55 -0700
From:      Steve Kargl <sgk@troutmask.apl.washington.edu>
To:        Dima Pasechnik <dimpase+freebsd@gmail.com>
Cc:        FreeBSD Ports <freebsd-ports@freebsd.org>
Subject:   Re: Default python is 3.6?
Message-ID:  <20190412195655.GA59279@troutmask.apl.washington.edu>
In-Reply-To: <CAAWYfq1ptqRXJqGh12JD=E8LhEux4Rt_xY5P1Do6NMZJ5GTQ0A@mail.gmail.com>
References:  <20190412161112.GA5963@troutmask.apl.washington.edu> <20190412161742.GA21349@troutmask.apl.washington.edu> <20190412162810.GA24821@troutmask.apl.washington.edu> <CAAWYfq1ptqRXJqGh12JD=E8LhEux4Rt_xY5P1Do6NMZJ5GTQ0A@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Apr 12, 2019 at 09:19:30PM +0200, Dima Pasechnik wrote:
> On Fri, Apr 12, 2019 at 6:29 PM Steve Kargl
> <sgk@troutmask.apl.washington.edu> wrote:
> >
> > On Fri, Apr 12, 2019 at 09:17:42AM -0700, Steve Kargl wrote:
> > >
> > > % find . -name math\*
> > > ./work/Python-3.6.8/Doc/library/math.rst
> > > ./work/Python-3.6.8/Modules/mathmodule.c
> > > ./work/Python-3.6.8/Lib/test/math_testcases.txt
> > > ./work/stage/usr/local/lib/python3.6/test/math_testcases.txt
> > >
> >
> > Well, this one is easy to fix.  I've sent this patch for 2 to 3
> > years now.  I've opened a PR about it.  Someday you guys might
> > actually fix this, because I will contacting core to get my
> > commit bit back.
> >
> This one is fixed in Python 3.7:
> https://github.com/python/cpython/blob/3.7/Modules/mathmodule.c
> via this commit:
> https://github.com/python/cpython/commit/4e6646fef5d2cc53422e4eca0b18201ed5a5c4b6
> 
> It is also fixed in Python 2.7.
> See https://github.com/python/cpython/pull/12027 for details.

Doesn't matter what the python developer have done.  A patch is
still required to build lang/python27.  Here's yet another 
copy of the patch.

--- ./Modules/mathmodule.c.orig	2019-04-12 10:00:28.518460000 -0700
+++ ./Modules/mathmodule.c	2019-04-12 10:01:24.846412000 -0700
@@ -71,7 +71,7 @@
 static const double sqrtpi = 1.772453850905516027298167483341145182798;
 
 static double
-sinpi(double x)
+_freebsd_ports_are_broken_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/_freebsd_ports_are_broken_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 / _freebsd_ports_are_broken_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(_freebsd_ports_are_broken_sinpi(absx))) - log(absx) -
             (log(lanczos_sum(absx)) - lanczos_g +
              (absx-0.5)*(log(absx+lanczos_g-0.5)-1));
     }

-- 
Steve



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190412195655.GA59279>