Mark Dickinson added the comment: (-0) ** 0.5 is a power operation, not a square root operation. As such, the relevant part of IEEE 754-2008 is section 9.2.1, "Special values", which says:
> pow (±0, y) is +0 for finite y > 0 and not an odd integer For the other cases, in general the philosophy is that we should raise exceptions where an FPE would be signalled, in preference to returning infinities and NaNs. So for example `math.sqrt(-1)` raises a ValueError rather than giving a NaN, and 1.0 / 0.0 raises ZeroDivisionError similarly. Unfortunately we don't have complete consistency here: for example 1e300 * 1e300 gives an infinity instead of raising. But that behaviour has been in the language for a looong time, and it's hard to change without breaking existing code. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30933> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com