New submission from Raymond Hettinger <raymond.hettin...@gmail.com>:
Consider adding new non-sequence fields to sys.float_info: doubling_rounding and ieee_754. The code in test_math defines a useful constant: # detect evidence of double-rounding: fsum is not always correctly # rounded on machines that suffer from double rounding. x, y = 1e16, 2.9999 # use temporary values to defeat peephole optimizer HAVE_DOUBLE_ROUNDING = (x + y == 1e16 + 4) There is another useful value in a float.__getformat__ which is hard to find and only documented for internal use: >>> float.__getformat__('double') 'IEEE, little-endian Making this information available would make it easier for users to do what we do in test_math: @requires_IEEE_754 @unittest.skipIf(HAVE_DOUBLE_ROUNDING, "fsum is not exact on machines with double rounding") def testFsum(self): ... ---------- components: Extension Modules messages: 377237 nosy: mark.dickinson, rhettinger, tim.peters priority: normal severity: normal status: open title: Add more fields to sys.float_info versions: Python 3.10 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41823> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com