[issue1640] Enhancements for mathmodule

Mark Dickinson report at bugs.python.org
Mon Jan 21 02:02:15 CET 2008


Mark Dickinson added the comment:

George:  I think my last post was a bit rude.  I apologize if it came across that way.

Mathematical rigor and IEEE-754 recommendations aren't necessarily in conflict here, 
though.  For example, the natural log function from (0, infinity) to (-infinity, 
infinity) extends naturally and uniquely to a continuous function on the closed subset 
[0, infinity] of the extended real line---i.e., the real line together with the two extra 
points -infinity and infinity.  With the appropriate topology, the extended real line is 
a perfectly well-defined and well-behaved mathematical object, though of course it's no 
longer a field.  Since IEEE-754 floats include infinities, it's reasonable, and sometimes 
useful, to regard the set of IEEE-floats as a computational model of the extended real 
line instead of the reals.

At any rate, I agree with you that log(0) and atanh(1) should raise Python exceptions, at 
least for now.  But these calculations are qualitatively different from log(-1) and 
atanh(2), and it wouldn't be at all unreasonable if they raised a different exception---
e.g. ZeroDivisionError instead of ValueError.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1640>
__________________________________


More information about the Python-bugs-list mailing list