[issue15544] math.isnan fails with some Decimal NaNs

Mark Dickinson report at bugs.python.org
Fri Aug 3 14:06:45 CEST 2012


Mark Dickinson added the comment:

> Decimal('snan').is_nan()
> just returns true and I am under the impression that IEEE 754 specifies > the same.

Sure, but IEEE 754 also specifies that math.sqrt(<signalling nan>) should signal.  Since both math.sqrt and math.isnan are going through __float__, we can't keep everyone happy here.

The question for me is really what __float__ should do.  IEEE 754 doesn't help here, since it doesn't cover decimal floating-point <-> binary floating-point conversions.

----------

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


More information about the Python-bugs-list mailing list