mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
Few coverage nitpicks for the cmath module (#102067)
- partial tests for cosh/sinh overflows (L535 and L771). I doubt both ||-ed conditions could be tested. - removed inaccessible case in sqrt (L832): ax=ay=0 is handled above (L823) because fabs() is exact. Also added test (checked with mpmath and gmpy2) for second condition on that line. - some trivial tests for isclose (cover all conditions on L1217-1218) - add comment for uncovered L1018 Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
This commit is contained in:
parent
7c106a443f
commit
592f65fdb5
3 changed files with 13 additions and 2 deletions
|
|
@ -829,7 +829,7 @@ cmath_sqrt_impl(PyObject *module, Py_complex z)
|
|||
ax = fabs(z.real);
|
||||
ay = fabs(z.imag);
|
||||
|
||||
if (ax < DBL_MIN && ay < DBL_MIN && (ax > 0. || ay > 0.)) {
|
||||
if (ax < DBL_MIN && ay < DBL_MIN) {
|
||||
/* here we catch cases where hypot(ax, ay) is subnormal */
|
||||
ax = ldexp(ax, CM_SCALE_UP);
|
||||
s = ldexp(sqrt(ax + hypot(ax, ldexp(ay, CM_SCALE_UP))),
|
||||
|
|
@ -1013,7 +1013,7 @@ cmath_phase_impl(PyObject *module, Py_complex z)
|
|||
double phi;
|
||||
|
||||
errno = 0;
|
||||
phi = c_atan2(z);
|
||||
phi = c_atan2(z); /* should not cause any exception */
|
||||
if (errno != 0)
|
||||
return math_error();
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue