[New-bugs-announce] [issue30933] Python not IEEE 754 float compliant for various zero results

Bobblehead report at bugs.python.org
Fri Jul 14 14:25:23 EDT 2017


New submission from Bobblehead:

>>> (-0)**.5
0.0

Should return -0.0

"Except that squareRoot(−0) shall be −0", IEEE 754-2008, Section 5.4.1

>>> 1/(-0.0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: float division by zero

>>> 1/(0.0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: float division by zero

Should return -inf, and inf respectively.

"For division, when the divisor is zero and the dividend is a finite non-zero number, the sign of the infinity is the exclusive OR of the operands’ signs", IEEE 754-2008, Section 7.3

----------
components: Interpreter Core
messages: 298368
nosy: Bobblehead
priority: normal
severity: normal
status: open
title: Python not IEEE 754 float compliant for various zero results
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30933>
_______________________________________


More information about the New-bugs-announce mailing list