New submission from John Mish <johnmish....@gmail.com>:
A1 >>> sorted([12.000000000000001, 2, 1.999, 2.1, 4, 12]) [1.999, 2, 2.1, 4, 12, 12.000000000000002] A2 >>> sorted([12.0000000000000001, 2, 1.999, 2.1, 4, 12]) [1.999, 2, 2.1, 4, 12.0, 12] B1 >>> sorted([11.999999999999999, 2, 1.999, 2.1, 4, 12]) [1.999, 2, 2.1, 4, 11.999999999999998, 12] B2 >>> sorted([11.9999999999999999, 2, 1.999, 2.1, 4, 12]) [1.999, 2, 2.1, 4, 12.0, 12] Hello, In A2 and in B2 we see the same output for 2 not equal expected values. It seems to be that floats are always first in list. So, what about trying to "store" if some float is 12 "in limit" of 12 but from "left/-"? So then it is < than 12. 12.000000000000000000000000000001 would be then 12 but in upper limit, right/+ so > 12 What do You think? Best regards. PS ofc I could use decimal, but if it shouldn't work, why it does not raise exception and ask for forgiveness... ? ---------- components: Interpreter Core messages: 391372 nosy: johnmish.iam priority: normal severity: normal status: open title: it seems that sorted built-in always return floats before int if they appear to be equal type: behavior versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43887> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com