-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integers are not sorted correctly #11023
Comments
Maybe the menu choice should say it works on unsigned integers. |
@alankilborn it's looks like bug |
Hi, can I work on this? |
If the name is If the name will be Currently it works as described on first post. Although, maybe that's the intended behavior? It looks like it sorts negative and positive separately, with a 0 in between, but negative in fact are treated as positive.
|
Personally, I don't see the utility of an "integer sort" that sorts in the order -3/-5/-7/0/1/2/4. I would say it's a bug in the implementation. If the developers decide not to make a change, then I will update the documentation to match that decision, but I would assume it's a bug that should be fixed, rather than documented around. |
I'm sure it was never meant to sort negative integers, from the time of first implementation. Why? It's too obvious of a miss. |
I don't see much logic in that. It should be a precondition of the sort that you only have the correct type of values over the entire sorting range. If you don't, don't complain about unexpected behavior. |
@donho This looks like regression introduced by #4413 in version 7.5.7. The previous versions work fine when we taken into account only numbers. Reading the issue, I don't see that the author's intention was to completley omit negative numbers. If now it should be only for natural numbers, then this name should be corrected, and it is worth adding in the documentation how negative values are treated. Edit: This change was probably done to make more flexible how we write numbers, even with text in front of them, and the sort was supposed to work fine anyway. But negative numbers are treated independently on this approach. Try with this values:
|
Hi, this is a student from University of Michigan. We found out this issue and it seems like the regression bug introduced by #4413 was made by a previous student from University of Michigan as a school project. We think we will be able to fix this bug and redeem the mistake. Is it okay if we claim this issue? |
We have implemented a sorting algorithm that takes negative numbers into account. Essentially, it behaves like natural sort, but it also takes in dashes (-) for negative numbers. However, there are an edge case that we want to ask the community what the intended behavior should be. Suppose we want to compare "-01" and "-1". Numerically, they have the same value. Then, which one should take priority? Should it be sorted ascendingly to:
or
We think the second option makes more sense, since the numerical value tied, we should compare them as two strings, in which case, the longer string has higher priority. |
I'm pretty sure ASCII character order is how you decide those things:
Any rational file system would do the same: $ tree --sort=name
.
├── -01.txt
└── -1.txt |
I see. Thank you! |
Description of the Issue
Negative numbers are sorted in reverse order
Steps to Reproduce the Issue
numbers.txt
Expected Behavior
Numbers are sorted ascending or descending (depending on option in step 4)
Actual Behavior
Non negative numbers are sorted correctly while negative numbers are sorted in reverse order (ascending for descending sort and vice versa)
Debug Information
Notepad++ v8.1.9.3 (64-bit)
Build time : Dec 6 2021 - 19:21:37
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line :
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
OS Name : Windows 10 Pro (64-bit)
OS Version : 2009
OS Build : 19042.1415
Current ANSI codepage : 1250
Plugins : mimeTools.dll NppConverter.dll NppExport.dll
The text was updated successfully, but these errors were encountered: