[issue6675] inf == inf (wrong IEEE 754 behaviour)

Mark Dickinson report at bugs.python.org
Mon Aug 10 18:29:29 CEST 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

The only issue with subnormals is that a simple relative error test is 
usually inappropriate.  For example, on an IEEE 754 machine 2**-1073 
should almost always be considered a good approximation to 2**-1074, since 
the two floats are adjacent; but the relative error here is 100%!  But I 
see that in the code you linked you have a combination of a relative error 
and absolute error tests, so this isn't a problem.

There's something similar to your code in the Python tests:  see function 
'almostEqualF' in Lib/test/test_cmath.py.

----------

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


More information about the Python-bugs-list mailing list