New submission from D Hardy <diggory.ha...@gmail.com>: Currently python evaluates infinity as equal to itself in my tests (2.6.2 and 3.0.1+ from ubuntu). I'm not entirely sure whether the behaviour of 'inf == inf' is specified by IEEE 754, but it leads to results like:
>>> 1e400 inf >>> 1e400 == 1e500 True And hence unittests which use tests like if not (math.fabs(value1 - value2) <= 0.00000001 * max(math.fabs(value1),math.fabs(value2))): fail don't always fail when they should (when a value is inf). This is a specific example (and probably not the recommended way of testing values in any case), but I think "inf != inf" is generally considered the correct behaviour. (Although maybe this is left over from the PEP 42 / PEP 754 mess; I wasn't able to find the current status of implementing IEEE 754 behaviour in python.) ---------- components: None messages: 91443 nosy: Cyborg16 severity: normal status: open title: inf == inf (wrong IEEE 754 behaviour) type: behavior versions: Python 2.6, Python 3.0 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6675> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com