Skip to content
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

Merged
merged 4 commits into from
Mar 20, 2025

Conversation

tsbranquinho
Copy link
Contributor

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.

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.
Copy link
Member

@LilithHafner LilithHafner left a 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.

@LilithHafner LilithHafner added needs tests Unit tests are required for this change bugfix This change fixes an existing bug display and printing Aesthetics and correctness of printed representations of objects. labels Mar 17, 2025
tsbranquinho and others added 2 commits March 17, 2025 19:15
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.
Copy link
Member

@LilithHafner LilithHafner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely tests, thanks!

@LilithHafner LilithHafner removed the needs tests Unit tests are required for this change label Mar 17, 2025
@tsbranquinho
Copy link
Contributor Author

Hey @LilithHafner, I have applied the suggested changes.
Let me know if there's anything else I should update.
Thanks for the review, I appreciate the feedback!

Copy link
Member

@LilithHafner LilithHafner left a 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!

@LilithHafner LilithHafner added the merge me PR is reviewed. Merge when all tests are passing label Mar 17, 2025
@JeffBezanson JeffBezanson merged commit f8eaeb4 into JuliaLang:master Mar 20, 2025
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug display and printing Aesthetics and correctness of printed representations of objects. merge me PR is reviewed. Merge when all tests are passing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants