[issue47121] math.isfinite() can raise exception when called on a number
Raymond Hettinger <raymond.hettinger@gmail.com> added the comment:
isfinite() should return True for all ints, without needing to coerce them to float
Whoa there. You're venturing into changing what those math functions were all about and the core approach to how they operate. A zigzag to this new direction would need discussion with all the math folks. Many tools in the math module are thin wrapper around libmath and we never intended to be universal handlers of all numeric types. We have a lot of functions that start by coercing their input to a float. My two cents is that this would open an endless can of worms and make everyone pay a time and complexity cost for a feature that almost no one needs. AFAICT is more of a purity issue than an actual practical need that would warrant separate code paths (for example, we recently closed an issue where someone wanted math.log() to have a separate code path for Fraction inputs where it return log(f.numerator) - log(f.denominator) with the goal of handling fractional values smaller than float_min). ---------- nosy: +mark.dickinson, tim.peters _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue47121> _______________________________________
participants (1)
-
Raymond Hettinger