mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Merged revisions 76978 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r76978 | mark.dickinson | 2009-12-21 15:22:00 +0000 (Mon, 21 Dec 2009) | 3 lines Issue #7518: Move substitute definitions of C99 math functions from pymath.c to Modules/_math.c. ........
This commit is contained in:
parent
0f72d6c25f
commit
f371859a4f
8 changed files with 250 additions and 231 deletions
|
@ -3,6 +3,7 @@
|
|||
/* much code borrowed from mathmodule.c */
|
||||
|
||||
#include "Python.h"
|
||||
#include "_math.h"
|
||||
/* we need DBL_MAX, DBL_MIN, DBL_EPSILON, DBL_MANT_DIG and FLT_RADIX from
|
||||
float.h. We assume that FLT_RADIX is either 2 or 16. */
|
||||
#include <float.h>
|
||||
|
@ -149,7 +150,7 @@ c_acos(Py_complex z)
|
|||
s2.imag = z.imag;
|
||||
s2 = c_sqrt(s2);
|
||||
r.real = 2.*atan2(s1.real, s2.real);
|
||||
r.imag = asinh(s2.real*s1.imag - s2.imag*s1.real);
|
||||
r.imag = m_asinh(s2.real*s1.imag - s2.imag*s1.real);
|
||||
}
|
||||
errno = 0;
|
||||
return r;
|
||||
|
@ -181,7 +182,7 @@ c_acosh(Py_complex z)
|
|||
s2.real = z.real + 1.;
|
||||
s2.imag = z.imag;
|
||||
s2 = c_sqrt(s2);
|
||||
r.real = asinh(s1.real*s2.real + s1.imag*s2.imag);
|
||||
r.real = m_asinh(s1.real*s2.real + s1.imag*s2.imag);
|
||||
r.imag = 2.*atan2(s1.imag, s2.real);
|
||||
}
|
||||
errno = 0;
|
||||
|
@ -238,7 +239,7 @@ c_asinh(Py_complex z)
|
|||
s2.real = 1.-z.imag;
|
||||
s2.imag = z.real;
|
||||
s2 = c_sqrt(s2);
|
||||
r.real = asinh(s1.real*s2.imag-s2.real*s1.imag);
|
||||
r.real = m_asinh(s1.real*s2.imag-s2.real*s1.imag);
|
||||
r.imag = atan2(z.imag, s1.real*s2.real-s1.imag*s2.imag);
|
||||
}
|
||||
errno = 0;
|
||||
|
@ -342,7 +343,7 @@ c_atanh(Py_complex z)
|
|||
errno = 0;
|
||||
}
|
||||
} else {
|
||||
r.real = log1p(4.*z.real/((1-z.real)*(1-z.real) + ay*ay))/4.;
|
||||
r.real = m_log1p(4.*z.real/((1-z.real)*(1-z.real) + ay*ay))/4.;
|
||||
r.imag = -atan2(-2.*z.imag, (1-z.real)*(1+z.real) - ay*ay)/2.;
|
||||
errno = 0;
|
||||
}
|
||||
|
@ -552,7 +553,7 @@ c_log(Py_complex z)
|
|||
if (0.71 <= h && h <= 1.73) {
|
||||
am = ax > ay ? ax : ay; /* max(ax, ay) */
|
||||
an = ax > ay ? ay : ax; /* min(ax, ay) */
|
||||
r.real = log1p((am-1)*(am+1)+an*an)/2.;
|
||||
r.real = m_log1p((am-1)*(am+1)+an*an)/2.;
|
||||
} else {
|
||||
r.real = log(h);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue