mirror of
https://github.com/python/cpython.git
synced 2025-08-24 18:55:00 +00:00
gh-119613: Use C99+ functions instead of Py_IS_NAN/INFINITY/FINITE (#119619)
This commit is contained in:
parent
86d1a1aa88
commit
cd11ff12ac
12 changed files with 140 additions and 142 deletions
|
@ -842,7 +842,7 @@ char * PyOS_double_to_string(double val,
|
|||
|
||||
*/
|
||||
|
||||
if (Py_IS_NAN(val) || Py_IS_INFINITY(val))
|
||||
if (isnan(val) || isinf(val))
|
||||
/* 3 for 'inf'/'nan', 1 for sign, 1 for '\0' */
|
||||
bufsize = 5;
|
||||
else {
|
||||
|
@ -860,10 +860,10 @@ char * PyOS_double_to_string(double val,
|
|||
}
|
||||
|
||||
/* Handle nan and inf. */
|
||||
if (Py_IS_NAN(val)) {
|
||||
if (isnan(val)) {
|
||||
strcpy(buf, "nan");
|
||||
t = Py_DTST_NAN;
|
||||
} else if (Py_IS_INFINITY(val)) {
|
||||
} else if (isinf(val)) {
|
||||
if (copysign(1., val) == 1.)
|
||||
strcpy(buf, "inf");
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue