Signalling NaN's are a pain because I'd want: is_nan(snan) == True
But statistics.median([1, 2, snan], on_nan='ignore') to raise an exception. And I'd want: statistics.median([1, 2, 3, qnan], on_nan='ignore') == 2 So we're back to needing yet another function is_nonsignaling_nan(). On Sun, Dec 29, 2019, 7:25 AM Steven D'Aprano <[email protected]> wrote: > On Sat, Dec 28, 2019 at 09:35:07PM -0800, Christopher Barker wrote: > > On Sat, Dec 28, 2019 at 3:40 PM David Mertz <[email protected]> wrote: > > > > > What about Decimal snan? > > > > > > > That version tries to call .is_nan() first, so works fine with the > Decimal > > snan. > > > > But as Nark pointed out, having an s an raise maybe the right thing to do > > anyway— it should not be used to indicate a missing value anyway. > > Merely testing whether a value is a NAN or not should not trigger the > "signalling" part of a signalling NAN. Only comparisons and mathematical > operations on sNANs should signal. > > Support for floating point sNANs is patchy and hardware dependent. > See here for more discussion: > > > https://mail.python.org/archives/list/[email protected]/thread/35NECLGFIVAHWTIPAYDBJOJJX3FSY233/ > > > -- > Steven > _______________________________________________ > Python-ideas mailing list -- [email protected] > To unsubscribe send an email to [email protected] > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/[email protected]/message/CD7DI7NDCILFMBWV52PXZVKAIXRDL722/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/76E6C4GZW7YF3FZWV6LXULBHGB3W6OHL/ Code of Conduct: http://python.org/psf/codeofconduct/
