Turn off ZeroDivisionError?

Neal Becker ndbecker2 at gmail.com
Sun Feb 10 18:04:21 EST 2008


Christian Heimes wrote:

> Grant Edwards wrote:
>> A more efficient implementation?  Just delete the code that
>> raises the exception and the HW will do the right thing.
> 
> Do you really think that the hardware and the C runtime library will do
> the right thing? Python runs on a lots platforms and architectures. Some
> of the platforms don't have a FPU or don't support hardware acceleration
> for floating point ops for user space applications. Some platforms don't
> follow IEEE 754 semantics at all.
> 
> It took us a lot of effort to get consistent results for edge cases of
> basic functions like sin and atan on all platforms. Simply removing
> those lines and praying that it works won't do it.
> 
> Christian
> 

I think, ideally, that on a platform that has proper IEEE 754 support we
would rely on the hardware, and only on platforms that don't would we add
extra software emulation.

With proper hardware support, the default would be a hardware floating pt
exception, which python would translate.

If the user wanted, she should be able to turn it off during some
calculation (but that would not be the default).




More information about the Python-list mailing list