Skip to content

Hopefully completely fix printf-family %a rounding #1287

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

Conversation

GabrielRavier
Copy link
Collaborator

The a conversion specifier to printf had some issues w.r.t. rounding, in
particular in edge cases w.r.t. "to nearest, ties to even" rounding (for
instance, "%.1a" with 0x1.78p+4 outputted 0x1.7p+4 instead of 0x1.8p+4).

This patch fixes this and adds several tests w.r.t ties to even rounding

@github-actions github-actions bot added the libc label Sep 13, 2024
@GabrielRavier GabrielRavier force-pushed the feat/hopefully-completely-fix-printf-family-a-conversion-specifier-rounding branch from 6d51cf8 to 3e16c85 Compare September 13, 2024 14:55
Copy link
Owner

@jart jart left a comment

Choose a reason for hiding this comment

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

This is impressive. Could you avoid the magic numbers?

@GabrielRavier GabrielRavier force-pushed the feat/hopefully-completely-fix-printf-family-a-conversion-specifier-rounding branch from 3e16c85 to 11d839d Compare September 15, 2024 15:29
The a conversion specifier to printf had some issues w.r.t. rounding, in
particular in edge cases w.r.t. "to nearest, ties to even" rounding (for
instance, "%.1a" with 0x1.78p+4 outputted 0x1.7p+4 instead of 0x1.8p+4).

This patch fixes this and adds several tests w.r.t ties to even rounding
@GabrielRavier GabrielRavier force-pushed the feat/hopefully-completely-fix-printf-family-a-conversion-specifier-rounding branch from 11d839d to f514716 Compare September 15, 2024 15:31
@GabrielRavier
Copy link
Collaborator Author

The commit now uses the FPI_Round_* enum values as appropriate.

@jart jart merged commit b55e4d6 into jart:master Sep 15, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants