mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Issue 3118: make test_math pass on Ubuntu/ia64. exp(-745.0) was raising
OverflowError incorrectly on this platform, presumably as a result of the libm setting errno = ERANGE for this call.
This commit is contained in:
parent
21a45e1bea
commit
fb1c4b98e9
1 changed files with 8 additions and 3 deletions
|
@ -82,12 +82,17 @@ is_error(double x)
|
|||
* should return a zero on underflow, and +- HUGE_VAL on
|
||||
* overflow, so testing the result for zero suffices to
|
||||
* distinguish the cases).
|
||||
*
|
||||
* On some platforms (Ubuntu/ia64) it seems that errno can be
|
||||
* set to ERANGE for subnormal results that do *not* underflow
|
||||
* to zero. So to be safe, we'll ignore ERANGE whenever the
|
||||
* function result is less than one in absolute value.
|
||||
*/
|
||||
if (x)
|
||||
if (fabs(x) < 1.0)
|
||||
result = 0;
|
||||
else
|
||||
PyErr_SetString(PyExc_OverflowError,
|
||||
"math range error");
|
||||
else
|
||||
result = 0;
|
||||
}
|
||||
else
|
||||
/* Unexpected math error */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue