On Fri, Dec 13, 2024 at 04:37:33AM +0000, Gary E. Miller (@garyedmundsmiller) via vc wrote:
> ... ... @@ -186,8 +203,11 @@ class RunningStats(object): > 186 203 self.variance = sum(pow((v-self.mu), 2) for v in values) / > self.num > 187 204 self.sigma = math.sqrt(self.variance) > 188 205 > 189 - if math.isnan(self.sigma) or 1e-12 >= abs(self.sigma): > 190 - # punt > 206 + # Note: math.isnan(float("+Inf")) is false, so avoid > isnan() > 207 + # Use isfinite() instead. > 208 + if ((not math.isfinite(self.sigma) or > 209 + 1e-12 >= abs(self.sigma))): > 210 + # Not finite, or too small. Punt > 191 211 self.skewness = float('nan') > 192 212 self.kurtosis = float('nan') > 193 213 return Hi Gary, math.isfinite() was added in Python 3.2 per https://docs.python.org/3/library/math.html. Should we use math.isinf() instead in order to retain Python 2 compatibility until we decide to drop that? Thanks, -Matt _______________________________________________ devel mailing list devel@ntpsec.org https://lists.ntpsec.org/mailman/listinfo/devel