[Numpy-discussion] Re: numpy, overflow, inf, ieee, and rich comparison
busby at icf.llnl.gov
Wed Oct 11 13:01:40 CDT 2000
It was an optional module (fpectl) that got added into Python 1.5.
Looks like it has been carried forward pretty much unchanged into the
2.0 release candidate. To use the facility, you need to build python
with --with-fpectl, then identify "dangerous" (likely to generate
SIGFPE) operations, and surround them with a pair of macros
PyFPE_START_PROTECT and PyFPE_END_PROTECT. This has the effect of
turning any SIGFPE into a Python exception. Start with
Include/pyfpe.h, look for example usage in Objects/floatobject.c. Grep
the python source for FPE_ to find the several places where these hooks
[ Paul Dubois wrote ]
>About controlling floating-point behavior with Numpy: I think that somewhere
>buried in the sources Lee Busby had us all set if we would just go through
>the source and stick in some macro in the right places (this was maybe 3
>years ago, hence the accurate and detailed memory dump) but it was on the
>todo list so long it outlived the death of the todo list.
>Anyway, my recollection is if we ever did it then we would have control when
>things like overflow happen. But we haven't. My last experience of this sort
>of thing was that it was completely a hardware-dependent thing, and you had
>to find out from each manufacturer what their routine was and how to call it
>or what compiler flag to use.
>Well, sorry to be so imprecise but I thought it worth mentioning that some
>steps had been taken even if I don't remember what they were.
More information about the Numpy-discussion