lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

2015-04-24 15:41 GMT+02:00 Egor Skriptunoff <>:

> Yes, we have strange results when sorting tables with NaNs inside.
> But we don't have errors there.
> Is it possible to receive "invalid order function for sorting" error for
> default sorting (using default order function) of a table filled with mixed
> integer/float values due to non-transitivity of default operator ">="?
> Transitivity of equality and relational operators sits very deep in our
> brains.
> A language without such transitivity would be counter-intuitive,
> programming on it would be error-prone.
> IMHO, if both numbers are inside range 2^53...2^63, they should be compared
> using conversion to integers, despite of possible performance penalty.

Didn't Roberto say just that? Let me find it ...

| (In terms of implementation, it means that integer-float should be
| compared converting the float to an integer; if the conversion fails,
| the numbers cannot be equal.) That definition is simple, sounds
| sensible and easy to explain, and makes equality transitive.