Repository navigation
Conversation
toEngineeringString() treated every negative value as "< 1" and kept multiplying by 1000 until it ran out of suffixes, so the calculator's Engineering mode showed -5 as "-5000a" and -1500 as "-1500a". Scale the absolute value and put the sign back in front. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem description
The calculator's Engineering display mode shows negative numbers wrong:
-5is shown as-5000aand-1500as-1500a.toEngineeringString()treats every negative value as< 1and keeps multiplying it by 1000 until it reaches the last suffix (a). It then cuts the result to 5 characters.Implementation description
Scale the absolute value and put the
-back in front. NewToEngineeringStringtest intests/helpers/source/utils.cppcovers positive and negative values.Screenshots
None. The change is only in the text the Engineering mode shows.
Additional things
I couldn't do a full ImHex build here (Windows without MSYS2). I compiled the function text from
utils.cppas-is with zig c++ (clang, C++23) in a small harness with the same checks as the new test. The 3 negative cases fail on master and all pass with the fix. The test file compiles against the realtests.hpp, but CI is the first run of it insidehelpers_test.