Skip to content

Commit

Permalink
Exclude MPFR workaround for MPFR >= 4.2.1
Browse files Browse the repository at this point in the history
Co-authored-by: Vincent Lefevre <[email protected]>

Closes #418
  • Loading branch information
skirpichev committed Apr 28, 2024
1 parent fec75d2 commit c57464b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/gmpy2_format.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,12 +592,14 @@ GMPy_MPC_Format(PyObject *self, PyObject *args)
if (mpcstyle)
strcat(tempbuf, " ");
else {
#if MPFR_VERSION < MPFR_VERSION_NUM(4,2,1)
/* Need to insert + if imag is nan or +inf. */
if (mpfr_nan_p(mpc_imagref(MPC(self))) ||
(mpfr_inf_p(mpc_imagref(MPC(self))) &&
mpfr_sgn(mpc_imagref(MPC(self))) > 0)) {
strcat(tempbuf, "+");
}
#endif
}
strcat(tempbuf, imagbuf);
if (strlen(imagbuf) < 50 &&
Expand Down

0 comments on commit c57464b

Please sign in to comment.