[Numpy-discussion] bug fix for exp()

Travis Oliphant oliphant at ee.byu.edu
Mon Oct 7 16:49:09 CDT 2002

> Hi,
> I've been lurking for a while, and using Numeric for about 5-6 months. I
> submitted a bug report about two months ago
> (https://sourceforge.net/tracker/index.php?func=detail&aid=594761&group_id=1369&atid=101369)
> regarding incorrect underflow behavior in exp().

My understanding is that this bug went away with a new version of Python.
It came about due to some change in Python and has not gone away.

My advice is to start using scipy (but of course that's my advice because
that's what I do).  Or at least start using scipy_base (which is easier to
install).   SciPy handles NAN's and INFS instead of raising errors and
this particular "bug" is not present because the error is not checked for.

> Another way to look into it would be if I could write some C code, then
> drop into Numeric's code and track what's going on when I call exp() for
> arguments that underflow. Is there a harness out there that I could just
> adapt to my own needs. Surely that's how other developers do it. If not,
> how *do* you fix bugs?

What's going on is that the system library for exp() is raising an
underflow error and rather than ignore it and return 0.0 like a good exp()
function, the error propagates to the top.

It's an annoying bug, I agree.

I've heard that it disappears with a new version of Python (2.2)  but, I'm
not entirely sure because I use scipy_base extensively.

-Travis O.

More information about the Numpy-discussion mailing list