On 12/29/19 11:00 PM, Tim Peters wrote:
[Richard Damon <rich...@damon-family.org>]
IEEE total_order puts NaN as bigger than infinity, and -NaN as less than
-inf.

One simple way to implement it is to convert the representaton to a 64
bit signed integer (not its value, but its representation) and if the
sign bit is set, complement the bottom 63 bits (because floats are
signed-magnitude). For pure python code, I don't know how hard it is to
get the representation of a float as a 64 bit integer. In C or Assembly
it is fairly easy as you can easily get around the type system, but I
don't know python well enough to do it.
There's a Python implementation here:

     https://bugs.python.org/msg336487

Yep, that looks like the canonical Total_order, just didn't know how to convert a float into an array of bytes and then to an int.

Now if this was just added to the library, and either median used it if the data was floats or sorted used it as part of the 'all floats' optimization.

--
Richard Damon
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/VOFUJRQ2E6AZLE7MHVKKTXUV322YAJCC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to