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 %a/%A format for zeros #40496

Merged
merged 1 commit into from
Apr 15, 2021
Merged

Conversation

bicycle1885
Copy link
Member

Currently, the %a (%A) format specification is broken for zeros. This PR fixes the following three independent problems:

julia> using Printf

julia> @sprintf "%a" 0.0  # expected:  "0x0p+0"
"0x0"

julia> @sprintf "%a" -0.0  # expected: "-0x0p+0"
"0x0"

julia> @sprintf "%.3a" 0.0  # expected: "0x0.000p+0"
"0x0000"

@bicycle1885 bicycle1885 requested a review from quinnj April 15, 2021 14:57
@kshyatt kshyatt added the display and printing Aesthetics and correctness of printed representations of objects. label Apr 15, 2021
@bicycle1885 bicycle1885 added bugfix This change fixes an existing bug display and printing Aesthetics and correctness of printed representations of objects. and removed display and printing Aesthetics and correctness of printed representations of objects. labels Apr 15, 2021
Copy link
Member

@quinnj quinnj left a comment

Choose a reason for hiding this comment

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

Thanks @bicycle1885!

@quinnj quinnj merged commit 691cf74 into JuliaLang:master Apr 15, 2021
@fredrikekre fredrikekre added the backport 1.6 Change should be backported to release-1.6 label Apr 15, 2021
@bicycle1885 bicycle1885 deleted the fix-printf-a branch April 16, 2021 06:17
@KristofferC KristofferC mentioned this pull request May 4, 2021
45 tasks
@KristofferC KristofferC removed the backport 1.6 Change should be backported to release-1.6 label Jul 12, 2021
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants