Numerical sort

General discussion related to "Everything".
Posts: 43
Joined: Wed Jan 09, 2013 9:06 am

Numerical sort

Postby w64bit » Thu Dec 07, 2017 1:43 pm

If I display the files by name, the sort is literal:

Is there any setting to use in order to display the files by name with numerical sort (like in File Explorer)?

Thank you.

Posts: 315
Joined: Wed May 24, 2017 9:22 pm

Re: Numerical sort

Postby NotNull » Thu Dec 07, 2017 3:24 pm

Some time ago I was looking for this, too, but couldn't find it.

After some thinking I concluded for myself that I didn't want it anyway, for a couple of reasons:

- "Computer-sort" is fast. "Human-sort" comes at an extra 'price' (especially when you have to sort hundreds of thousands or even millions of filenames, like in Everything). My guess is that it will have some serious impact on the speed of Everything.
- What about decimal numbers? In decimal numbers, 2.5 > 2.11 , but when you talk about (software) versions, 2.11 > 2.5. How can a sorting algorithm distinguish between those?
- Which get even more confusing if you consider that in (for example) my country the "," is the decimal separator and "." is the thousands separator.
- And what to do with hex numbers?

Anyway, I gave up and 'surrendered' to computer-sort ...

BTW: Microsoft calls this 'numerical sort' and there is a Group Policy to change it's behaviour in Explorer (the file manager)
EDIT: WHich means that there might be a Windows API that can be called to force this numerical sorting

Posts: 1762
Joined: Thu Sep 03, 2009 6:48 pm

Re: Numerical sort

Postby therube » Sun Dec 17, 2017 10:50 pm

A sorting method uses some algorithm, so based on the method used it is always "right".

So an ascii sort gives one set of results.
And a "natural" (or numeric) sort gives another set of results.

Both are "right".

A users perception or a software writers intention are what leads to questions ;-).

Is software 2.11 > 2.5 ?
Did the author actually mean 2._0_5 or 2._5_.0?
If the latter, then 2.50 > 2.11.

Hex is a really good question, which I posed here, (& which I did not get an adequate answer, & which I'll revisit at some point.) [DIR, Everything, & unix sorts using various options all returned the same results. But Salamander's "Numeric" sort returned, to what seemed to me, to be illogical results - but, it must fit the algorithm they've used, so in that respect, is correct ;-)]

Anyhow, "natural sort", in Everything was long ago put on a todo list.

Note the "numbers" that start with "00".
And then also the "0A05" entry toward the top of the list. ... umbers.png

Return to “General”