On Dec 30, 2019, at 15:56, David Mertz <me...@gnosis.cx> wrote:
>
>
> > The order he generates is very close to the IEEE total order, the
> > difference are:
>> > 1) It doesn't seperate -0 for +0, which shouldn't matter for most
>> > applications.
>> > 2) It doesn't provide an order between NaNs, but unless you are taking
>> > special measures to distinguish the NaNs anyway, that doesn't really
>> > matter.
>>
>> And it also doesn’t distinguish equal but distinct-bit-pattern subnormal
>> values.
>
> This is more in the category of "things that definitely do not matter", but I
> had forgotten about subnomal floating-point values. How does IEEE totalOrder
> mandate ordering those vs. equivalent normal numbers?
I think it’s in the category of “things that matter about as often as
totalOrder matters in the first place (which is rarely)”. But that’s because
the only reasons I can think of to want totalOrder are to make sure I get the
exact same order on every implementation (so I’ll take any standard as long as
it’s actually a standard that everyone implements the same way), or to make
sure I get an order that distinguishes all distinct bit patterns (probably
because I’m smuggling non-float values in my float bits or something? I can’t
think of a use that would be meaningful with median…). In fact, in any other
case I can think of besides those two, I would explicitly _not_ want this
behavior, because it breaks stability (and probably hurts performance?) for no
visible benefit. But maybe that’s just a failure of my imagination.
Anyway, without rereading the spec, I believe it mandates that all equal but
distinct bit patterns are ordered by the exponent times the sign, which handles
both -0<0 and more vs. less subnormal representations of equal finite values.
While we’re at it, IIRC, it specifically mandates a<=b rather than a<b for
unequal values, and I’m not sure why that is.
_______________________________________________
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/23BY6HGAY3A2NXDUZJHNP4VKHYE6LAKC/
Code of Conduct: http://python.org/psf/codeofconduct/