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

next in thread | previous in thread | raw e-mail | index | archive | help
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.
I've just asked whether upstream will consider backporting this to
Python 3.5 and 3.6.
If not, it would need to be done in FreeBSD only.







>
>
> --- work/Python-3.6.8/Modules/mathmodule.c.orig 2019-04-12 09:23:42.329350000 -0700
> +++ work/Python-3.6.8/Modules/mathmodule.c      2019-04-12 09:24:37.977029000 -0700
> @@ -67,7 +67,7 @@
>  static const double logpi = 1.144729885849400174143427351353058711647;
>
>  static double
> -sinpi(double x)
> +_freebsd_ports_are_broken_sinpi(double x)
>  {
>      double y, r;
>      int n;
> @@ -296,7 +296,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;
> @@ -320,7 +320,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);
> @@ -390,7 +390,7 @@
>      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(_freebsd_ports_are_broken_sinpi(absx))) - log(absx) - r;
>      if (Py_IS_INFINITY(r))
>          errno = ERANGE;
>      return r;
>
> --
> Steve
> _______________________________________________
> freebsd-ports@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-ports
> To unsubscribe, send any mail to "freebsd-ports-unsubscribe@freebsd.org"



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