Turn off ZeroDivisionError?

Neal Becker ndbecker2 at gmail.com
Sat Feb 9 17:03:53 EST 2008


I'd like to turn off ZeroDivisionError.  I'd like 0./0. to just give NaN,
and when output, just print 'NaN'.  I notice fpconst has the required
constants.  I don't want to significantly slow floating point math, so I
don't want to just trap the exception.

If I use C code to turn off the hardware signal, will that stop python from
detecting the exception, or is python checking for 0 denominator on it's
own (hope not, that would waste cycles).




More information about the Python-list mailing list