]> granicus.if.org Git - python/commit
SF bug 525705: [2.2] underflow raise OverflowException.
authorTim Peters <tim.peters@gmail.com>
Sat, 9 Mar 2002 04:58:24 +0000 (04:58 +0000)
committerTim Peters <tim.peters@gmail.com>
Sat, 9 Mar 2002 04:58:24 +0000 (04:58 +0000)
commitdc5a508761d7260bc863a2f3068723c298336382
tree7a59e85272d1bebdce6c05c0da21d5b5d7f926f4
parentd50e544b9f67738f122d9931eab8b8d71633527a
SF bug 525705:  [2.2] underflow raise OverflowException.
Another year in the quest to out-guess random C behavior.

Added macros Py_ADJUST_ERANGE1(X) and Py_ADJUST_ERANGE2(X, Y).  The latter
is useful for functions with complex results.  Two corrections to errno-
after-libm-call are attempted:

1. If the platform set errno to ERANGE due to underflow, clear errno.
   Some unknown subset of libm versions and link options do this.  It's
   allowed by C89, but I never figured anyone would do it.

2. If the platform did not set errno but overflow occurred, force
   errno to ERANGE.  C89 required setting errno to ERANGE, but C99
   doesn't.  Some unknown subset of libm versions and link options do
   it the C99 way now.

Bugfix candidate, but hold off until some Linux people actually try it,
with and without -lieee.  I'll send a help plea to Python-Dev.
Include/pyport.h
Modules/cmathmodule.c
Objects/floatobject.c