This is an archive of the discontinued LLVM Phabricator instance.

[libc] Make printf decimal long doubles use hex
ClosedPublic

Authored by michaelrj on Apr 12 2023, 3:43 PM.

Details

Summary

Decimal long doubles are not commonly used, and aren't currently
supported by the algorithm used for decimal float conversions. To avoid
giving incorrect answers, this patch adds a temporary exception to print
long doubles in hexadecimal even when decimal is requested.

Diff Detail

Event Timeline

michaelrj created this revision.Apr 12 2023, 3:43 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 12 2023, 3:43 PM
michaelrj requested review of this revision.Apr 12 2023, 3:43 PM
sivachandra accepted this revision.May 2 2023, 10:52 PM
sivachandra added inline comments.
libc/src/stdio/printf_core/float_hex_converter.h
32–34

I think, whats going on here is that you are converting the other conversion names, e, f and g to a and E, F and G to A. If this is correct, can you add a comment?

This revision is now accepted and ready to land.May 2 2023, 10:52 PM
michaelrj updated this revision to Diff 519175.May 3 2023, 11:08 AM
michaelrj marked an inline comment as done.

add comment to clarify the variable named "a"

This revision was landed with ongoing or failed builds.May 3 2023, 11:12 AM
This revision was automatically updated to reflect the committed changes.