diff options
author | Victor Stinner <vstinner@python.org> | 2021-10-15 17:45:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-15 17:45:34 (GMT) |
commit | 00ffc4513df7b89a168e88da4d1e3ac367f7682f (patch) | |
tree | e3b57e2fe5eab5bf559fe850a3a8ed070da2d3c0 /Python/pymath.c | |
parent | 51f8196d05f0e271358eee0f90fe044b20449fb5 (diff) | |
download | cpython-00ffc4513df7b89a168e88da4d1e3ac367f7682f.zip cpython-00ffc4513df7b89a168e88da4d1e3ac367f7682f.tar.gz cpython-00ffc4513df7b89a168e88da4d1e3ac367f7682f.tar.bz2 |
bpo-45440: Remove pymath.c fallbacks (GH-28977)
Remove fallbacks for missing round(), copysign() and hypot() in
Python/pymath.c. Python now requires these functions to build.
These fallbacks were needed on Visual Studio 2012 and older. They are
no longer needed since Visual Stuido 2013. Python is now built with
Visual Studio 2017 or newer since Python 3.6.
Diffstat (limited to 'Python/pymath.c')
-rw-r--r-- | Python/pymath.c | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/Python/pymath.c b/Python/pymath.c index b2681f2..e7d0161 100644 --- a/Python/pymath.c +++ b/Python/pymath.c @@ -17,51 +17,3 @@ void _Py_set_387controlword(unsigned short cw) { __asm__ __volatile__ ("fldcw %0" : : "m" (cw)); } #endif // HAVE_GCC_ASM_FOR_X87 - - -#ifndef HAVE_HYPOT -double hypot(double x, double y) -{ - double yx; - - x = fabs(x); - y = fabs(y); - if (x < y) { - double temp = x; - x = y; - y = temp; - } - if (x == 0.) - return 0.; - else { - yx = y/x; - return x*sqrt(1.+yx*yx); - } -} -#endif /* HAVE_HYPOT */ - -#ifndef HAVE_COPYSIGN -double -copysign(double x, double y) -{ - /* use atan2 to distinguish -0. from 0. */ - if (y > 0. || (y == 0. && atan2(y, -1.) > 0.)) { - return fabs(x); - } else { - return -fabs(x); - } -} -#endif /* HAVE_COPYSIGN */ - -#ifndef HAVE_ROUND -double -round(double x) -{ - double absx, y; - absx = fabs(x); - y = floor(absx); - if (absx - y >= 0.5) - y += 1.0; - return copysign(y, x); -} -#endif /* HAVE_ROUND */ |