-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Fix #37756: Correct formatting of hexadecimal imaginary parts #57803
Conversation
The 'show' method for 'Complex' was not properly handling cases where the imaginary part was represented in hexadecimal ('0x'). This could lead to missing multiplication symbols '*' in the output, making the formatting inconsistent. To fix this, a check using 'occursin("0x", repr(i))' was added to detect these cases and ensure proper formatting. This improves the consistency of complex number representations and prevents ambiguities in the printed output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! You have a good solution and should also add tests to make sure it works as expected.
Replaced explicit conditionals with a type check to make the code easier to understand and maintain. This ensures that the logic is clearer while preserving the original behavior. Co-authored-by: Lilith Orion Hafner <[email protected]>
These additions improve test coverage and ensure robust handling of different numeric representations in the `show` function. This extends the test suite in reference to issue JuliaLang#37756.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely tests, thanks!
Co-authored-by: Lilith Orion Hafner <[email protected]>
Hey @LilithHafner, I have applied the suggested changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This looks good to me (LGTM). We'll wait to make sure that CI passes (or at least all the checks that pass on master also pass here) and then merge. Thank you for you contribution!
The 'show' method for 'Complex' was not properly handling cases where the imaginary part was represented in hexadecimal ('0x'). This could lead to missing multiplication symbols '*' in the output, making the formatting inconsistent.
To fix this, a check using 'occursin("0x", repr(i))' was added to detect these cases and ensure proper formatting.
This improves the consistency of complex number representations and prevents ambiguities in the printed output.