Re: table sort: IEEE floating-point number NaN?
'Lars Müller' via lua-l <[email protected]> Sun, 26 Apr 2026 00:49:18 +0200
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <[email protected]> |
If passing NaNs may cause a sorting algorithm to produce an error, that's a feature. You must not try to sort the unsortable (and if you do, you should be explicit about how you want it sorted). -Lars On 25 April 2026 11:29:18 CEST, Sean Conner <[email protected]> wrote: >It was thus said that the Great sur-behoffski once stated: >> (Interesting discussion elided for briefness.) >> >> Does the floating-point number NaN (assume IEEE754 etc.) always >> compare as false to any other value, even another NaN? > > Yes. IEEE-754 requires that NaN is not equal to NaN. You can see this >yourself with Lua: > > Lua 5.4.6 Copyright (C) 1994-2023 Lua.org, PUC-Rio > > x=0/0 > > print(x,x==x) > nan false > > -spc > >-- >You received this message because you are subscribed to the Google Groups "lua-l" group. >To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. >To view this discussion visit https://groups.google.com/d/msgid/lua-l/20260425092918.GA1910%40brevard.conman.org. -- You received this message because you are subscribed to the Google Groups "lua-l" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/lua-l/412B93E8-10EB-4370-85F8-4D996420B9E9%40gmx.de.