You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mark: it's not really ready for a patch, since there's no agreement yet on how best to solve this. In fact, I'm tempted to close as "wont fix": the argument is that the math module consists for the most part only of thin wrappers around the platform math library.
The underlying need (as far as I understand it) is to be able to tell whether a given number is a nan or not without having to know in advance whether it's a float, int or Decimal instance. There may be other ways of achieving this goal (like adding an is_nan method to float and int, for example.)
Activity
stevendaprano commentedon Aug 26, 2013
math.isfinite currently raises ValueError when given a Decimal sNAN (signalling NAN).
I've run into a situation where I'm calling isfinite() on a numeric value which may be a Decimal sNAN, and it would be nice if it returned False.
On the other hand, see the discussion on bpo-15544, which possibly leads to the conclusion that raising ValueError is the right thing to do.
http://bugs.python.org/issue15544
Either way, behaviour should be documented.
BreamoreBoy commentedon Aug 3, 2014
Steven, can you propose a patch for this?
mdickinson commentedon Aug 6, 2014
Mark: it's not really ready for a patch, since there's no agreement yet on how best to solve this. In fact, I'm tempted to close as "wont fix": the argument is that the math module consists for the most part only of thin wrappers around the platform math library.
The underlying need (as far as I understand it) is to be able to tell whether a given number is a nan or not without having to know in advance whether it's a float, int or Decimal instance. There may be other ways of achieving this goal (like adding an
is_nanmethod tofloatandint, for example.)skrah commentedon Oct 14, 2014
"Wont fix" sounds good to me.