Turn off ZeroDivisionError?

Grant Edwards grante at visi.com
Sun Feb 10 19:07:13 EST 2008


On 2008-02-10, Christian Heimes <lists at cheimes.de> wrote:

> Python's a/0 outcome doesn't violate the standards

It does.

> because Python doesn't promise to follow the IEEE 754 standard in the first place.

Whether a certain behavior violates that standard is
independant of whether somebody promised to follow the standard
or not.

> Mark and I are working hard to make math in Python more
> reliable across platforms. So far we have fixed a lot of
> problems but we haven't discussed the a/0 matter.
>
> The best we could give you is an option that makes Python's floats more
> IEEE 754 like:
>
>>>> from somemodule import ieee754
>>>> with ieee754:
> ...    r = a/0
> ...    print r
> inf

That would be great.

-- 
Grant Edwards                   grante             Yow!  A dwarf is passing
                                  at               out somewhere in Detroit!
                               visi.com            



More information about the Python-list mailing list