Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:
Nice analysis and bug report, thank you! That's pretty strange behaviour for float32, but I guess we're stuck with it. I wonder if the type assertion has outlived its usefulness? I.e. drop the `T == U` part and change the assertion to `assert count == count2` only. If we removed the failing part of the assertion, and changed the final line to `return (U, total)`, that ought to keep the exact sum but convert to float32 later, rather than float64. I am inclined to have the stdev of float32 return a float32 is possible. What do you think? We should check the numpy docs to see what the conversion rules for numpy floats are. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39218> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com