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

Samuele Pedroni pedronis at bluewin.ch
Mon Aug 4 18:57:29 EDT 2003


math.log raises different unrelated exceptions depending on the type of a 
zero argument:

 >>> math.log(0)

Traceback (most recent call last):
   File "<pyshell#1>", line 1, in -toplevel-
     math.log(0)
OverflowError: math range error
 >>> math.log(0L)

Traceback (most recent call last):
   File "<pyshell#2>", line 1, in -toplevel-
     math.log(0L)
ValueError: math domain error

 >>> math.log(0.0)

Traceback (most recent call last):
   File "<pyshell#4>", line 1, in -toplevel-
     math.log(0.0)
OverflowError: math range error

should this stay this way? notice that the (only) common ancestor of 
OverflowError and ValueError is StandardError.

regards.




More information about the Python-Dev mailing list