Skip to content

tiny PR to fix writeshortest for 0.0 when hash==false #58502

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

digital-carver
Copy link
Contributor

Currently,

julia> Base.Ryu.writeshortest(0.0, false, false, false)
"00"

The second 0 is intended to be printed when the last argument hash is true and a decimal point is printed, to follow that . (i.e. "0.0"). But it's currently printed also when hash is false, resulting in this function not printing the actual "shortest" numeric string for this case.

(issue first noted by Dave MacMahon on Slack)

@Keno Keno added the needs tests Unit tests are required for this change label May 23, 2025
@Keno
Copy link
Member

Keno commented May 23, 2025

Needs a test

@LilithHafner
Copy link
Member

The fix LGTM once a test is added. Thanks, @digital-carver!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs tests Unit tests are required for this change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants