[Python-bugs-list] [ python-Bugs-525705 ] [2.2] underflow raise OverflowException
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 08 Mar 2002 21:00:07 -0800
Bugs item #525705, was opened at 2002-03-04 18:56
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=525705&group_id=5470
Category: Python Interpreter Core
Group: Platform-specific
Status: Open
Resolution: None
Priority: 7
Submitted By: Huaiyu Zhu (hzhu)
Assigned to: Tim Peters (tim_one)
Summary: [2.2] underflow raise OverflowException
Initial Comment:
Python 2.2 (#1, Mar 4 2002, 15:25:20)
[GCC 2.95.2 19991024 (release)] on linux2
>>> 1e-200**2
OverflowError: (34, 'Numerical result out of range')
The machine runs SuSE 7.1. $ rpm -q gcc glibc
gcc-2.95.2-149
glibc-2.2-7
On this machine, the following test C program produces
1e+200 inf 34 Numerical result out of range 34
1e-200 0 34 Numerical result out of range 34
without -lieee, and
1e+200 inf 0 Success 34
1e-200 0 0 Success 34
with -lieee.
However, editing pyconfig.h.in to add line
#define HAVE_LIBIEEE 1
does not change Python's behavior.
This problem does not occur on another machine, running
Red Hat 6.1 upgraded to 7.1. It exhibits exactly the
same behavior regarding C, but Python underflows to 0.0
properly.
The test C program is
#include <math.h>
#include <stdlib.h>
#include <errno.h>
extern int errno;
main() {
double x;
x = 1e200;
printf("%g %5g %d %s %d\n", x, pow(x, 2), errno,
strerror(errno), ERANGE);
x = 1e-200;
printf("%g %5g %d %s %d\n", x, pow(x, 2), errno,
strerror(errno), ERANGE);
}
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2002-03-09 00:00
Message:
Logged In: YES
user_id=31435
I'm hoping this is fixed in CVS now. Since we're never
going to sort out the Linux config mess, it tries to worm
around it via more macros.
Include/pyport.h; new revision: 2.45
Modules/cmathmodule.c; new revision: 2.28
Objects/floatobject.c; new revision: 2.111
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2002-03-08 22:43
Message:
Logged In: YES
user_id=31435
Python used to link with -lieee. Rev 1.139 of configure.in
changed that. The checkin comment is:
"""
Gregor Hoffleit: Don't link with the libieee library if
it's not necessary
"""
Thanks, Gregor <wink/sigh>.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2002-03-08 22:40
Message:
Logged In: YES
user_id=31435
Assigned to me, because the Linux weenies are apparently
too frightened of radix points to get near this <wink>.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2002-03-05 19:01
Message:
Logged In: YES
user_id=31435
Changed Group to "Platform specific" and added "[2.2]" to
the Summary line instead.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2002-03-04 19:48
Message:
Logged In: YES
user_id=31435
Boosted priority. I'd assign to me, except I don't know
anything about Linux config.
Paul Rubin reported success (no more bogus OverflowError)
after
"""
I manually put "-lieee" into the LIBS=... line in the
makefile and rebuilt.
"""
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=525705&group_id=5470