Message403474
Py_OVERFLOWED() documentation says that the function is not reliable since C99. Python is using C99 since Python 3.6.
/* Py_OVERFLOWED(X)
* Return 1 iff a libm function overflowed. Set errno to 0 before calling
* a libm function, and invoke this macro after, passing the function
* result.
* Caution:
* This isn't reliable. C99 no longer requires libm to set errno under
* any exceptional condition, but does require +- HUGE_VAL return
* values on overflow. A 754 box *probably* maps HUGE_VAL to a
* double infinity, and we're cool if that's so, unless the input
* was an infinity and an infinity is the expected result. A C89
* system sets errno to ERANGE, so we check for that too. We're
* out of luck if a C99 754 box doesn't map HUGE_VAL to +Inf, or
* if the returned result is a NaN, or if a C89 box returns HUGE_VAL
* in non-overflow cases.
* X is evaluated more than once.
* Some platforms have better way to spell this, so expect some #ifdef'ery.
*
* OpenBSD uses 'isinf()' because a compiler bug on that platform causes
* the longer macro version to be mis-compiled. This isn't optimal, and
* should be removed once a newer compiler is available on that platform.
* The system that had the failure was running OpenBSD 3.2 on Intel, with
* gcc 2.95.3.
*
* According to Tim's checkin, the FreeBSD systems use isinf() to work
* around a FPE bug on that platform.
*/ |
|
Date |
User |
Action |
Args |
2021-10-08 14:00:48 | vstinner | set | recipients:
+ vstinner, mark.dickinson |
2021-10-08 14:00:48 | vstinner | set | messageid: <1633701648.12.0.681387521919.issue45412@roundup.psfhosted.org> |
2021-10-08 14:00:48 | vstinner | link | issue45412 messages |
2021-10-08 14:00:47 | vstinner | create | |
|