Skip to content

Commit 99669a1

Browse files
committed
Address review: use Py_IS_* macros
1 parent fc3f91d commit 99669a1

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

Objects/complexobject.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,20 +122,20 @@ _Py_c_quot(Py_complex a, Py_complex b)
122122

123123
/* Recover infinities and zeros that computed as nan+nanj. See e.g.
124124
the C11, Annex G.5.2, routine _Cdivd(). */
125-
if (isnan(r.real) && isnan(r.imag)) {
126-
if ((isinf(a.real) || isinf(a.imag))
127-
&& isfinite(b.real) && isfinite(b.imag))
125+
if (Py_IS_NAN(r.real) && Py_IS_NAN(r.imag)) {
126+
if ((Py_IS_INFINITY(a.real) || Py_IS_INFINITY(a.imag))
127+
&& Py_IS_FINITE(b.real) && Py_IS_FINITE(b.imag))
128128
{
129-
const double x = copysign(isinf(a.real) ? 1.0 : 0.0, a.real);
130-
const double y = copysign(isinf(a.imag) ? 1.0 : 0.0, a.imag);
129+
const double x = copysign(Py_IS_INFINITY(a.real) ? 1.0 : 0.0, a.real);
130+
const double y = copysign(Py_IS_INFINITY(a.imag) ? 1.0 : 0.0, a.imag);
131131
r.real = Py_INFINITY * (x*b.real + y*b.imag);
132132
r.imag = Py_INFINITY * (y*b.real - x*b.imag);
133133
}
134-
else if ((fmax(abs_breal, abs_bimag) == Py_INFINITY)
135-
&& isfinite(a.real) && isfinite(a.imag))
134+
else if ((Py_IS_INFINITY(abs_breal) || Py_IS_INFINITY(abs_bimag))
135+
&& Py_IS_FINITE(a.real) && Py_IS_FINITE(a.imag))
136136
{
137-
const double x = copysign(isinf(b.real) ? 1.0 : 0.0, b.real);
138-
const double y = copysign(isinf(b.imag) ? 1.0 : 0.0, b.imag);
137+
const double x = copysign(Py_IS_INFINITY(b.real) ? 1.0 : 0.0, b.real);
138+
const double y = copysign(Py_IS_INFINITY(b.imag) ? 1.0 : 0.0, b.imag);
139139
r.real = 0.0 * (a.real*x + a.imag*y);
140140
r.imag = 0.0 * (a.imag*x - a.real*y);
141141
}

0 commit comments

Comments
 (0)