[Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison)

Thomas Wouters thomas@xs4all.net
Wed, 11 Oct 2000 16:24:37 +0200


On Wed, Oct 11, 2000 at 10:26:14AM +0200, Thomas Wouters wrote:

[ Py2.0 mathmodule behaves differently when doing math.exp(-1000) and such ]

> Actually, there was some activity to define the right combination of
> _GNU_SOURCE, _POSIX_SOURCE, _XOPEN_SOURCE, _BSD_SOURCE, et al, but I'm not
> sure what the end result was. If any #define changes the behaviour of glibc,
> these would definately be it ! A simple test might be to compile 1.5.2 with
> the config.h from 2.0, and manually add whatever _*_SOURCE defines aren't in
> 1.5.2. (They reside in Python.h and config.h, currently.) I'll see if I can
> reproduce it on the glibc almost-2.2 (that is, glibc-2.1.94) systems here,
> and do some of the above tests.

Well, that was no success. I do see the difference between 1.5.2 and 2.0,
but *damned* if I can figure out where it comes from. It doesn't seem to be
any of the properly placed defines, and it doesn't seem to be the changes in
mathmodule itself. Not autoconf, either. What I did:

old tree (stock Python 1.5.2): math.exp(-1000) returns 0.0
new tree (current CVS): math.exp(-1000) raises OverflowError

(No difference between threads enabled and disabled.)

Use new config.h in old tree: math.exp(-1000) returned 0.0

Add _GNU_SOURCE and _XOPEN_SOURCE definitions (respectively 1 and 500, just
like new Python.h does) to Python.h in old tree: math.exp(-1000) returns 0.0

Copy mathmodule.c and mymath.h from old tree to new tree: math.exp(-1000)
raises OverflowError

Copy new mathmodule.c to old tree (adding an 'include math.h' because the
old Python.h isn't doing that): math.exp(-1000) returns 0.0

Copy config.h and Python.h from new tree to old one (removing the include of
unicodestring.h and codecs.h, and including mymalloc.h rather than pymem.h
to make it compile): math.exp(-1000) returns 0.0

So, as far as I can tell, it's not related to any code in mathmodule.c
itself, nor any defines in config.h or Python.h. mymath.h isn't used either,
as far as I can tell it only contains stuff for broken math stuff on obscure
platforms. Sounds like time for that glibc expert right about now ;-P

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!