Re:The surprisingly difficult problem of user-defined order ...
by recursive on Saturday January 16, 2021 @12:00AM
(#25800187)
Floating point numbers aren't special data types either.
You don't need decimal. It works fine with binary floating point. The reason they don't call it robust is that it requires re-balancing, but so does your proposal.
Re:The surprisingly difficult problem of user-defined order ...
by spiffytech on Saturday January 16, 2021 @12:17AM
(#25800252)
float/double data types have a hard requirement of periodic rebalancing to support unbounded repositions. Lexicographical sorting does not require rebalancing ever, though it may be performed as an optional storage/bandwidth optimization. That is a very meaningful distinction in my book.
Re:The surprisingly difficult problem of user-defined order ...
by vbezhenar on Saturday January 16, 2021 @08:42AM
(#25802106)
I would use byte array instead of strings, as they should be supported by everything and they are more compact. But I'm crazy guy who wants to optimize everything, I think that in reality string will work just as well and probably easier to debug when you need to deal with it (also easier to serialize if you need to pass it around).
Strings work everywhere, and are first-class data types it most systems/languages. They take more bits per digit than numbers (though you can choose a wider alphabet to mitigate that, such as ASCII 33 '!' through 126 '~'), but I'm happy to trade the storage away for using a first-class data types.