[Python-Dev] histerical math.log(zero)

Tim Peters tim.one at comcast.net
Mon Aug 4 14:23:26 EDT 2003

[Samuele Pedroni]
> I was asking this because I have just finished making jython handle
> log(long) itself too. And I noticed that test_long is picky about the
> ValueError thing.

It could test for one of (ValueError, OverflowError, ZeroDivisionError)
instead, and also count no exception as a success.  We probably see all 4 of
those behaviors in CPython across platforms for log(0.0).
Python-the-language doesn't really define exceptional math behaviors.

> I should have read the manual, sorry. I was more wondering that
> there's no encompassing math exception.

Ask Guido <wink>:

    CPython started life with "classic" (pre-754) libms, where ERANGE got
    mapped to OverflowError and EDOM to ValueError.

IOW, there has never been an encompassing math exception.  ArithmeticError
may have been an attempt to create one, but ValueError doesn't derive from
it so if that was the plan, it didn't work.

More information about the Python-Dev mailing list