This is an archive of the discontinued LLVM Phabricator instance.

[libc++][format] Fixes floating-point formatting.
ClosedPublic

Authored by Mordante on Aug 8 2022, 10:42 AM.

Details

Summary

Formatting the alternate form for the general categories should keep the
trailing zeros. This was reported by @fsb4000 in D131336.

The default format uses general formatting but this should not keep the
trailing zeros so the default format is not passed to the formatter.

While testing I found an off by one error; finding the exponent character
e in 1e+03 will start at after the 1 so a size of 4 can contain an
exponent.

Diff Detail

Event Timeline

Mordante created this revision.Aug 8 2022, 10:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 8 2022, 10:42 AM
Mordante requested review of this revision.Aug 8 2022, 10:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 8 2022, 10:42 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante updated this revision to Diff 450890.Aug 8 2022, 11:29 AM

Removes Unicode to fix CI.

Mordante updated this revision to Diff 451538.Aug 10 2022, 10:10 AM

Adds a missing include.

fsb4000 accepted this revision.Aug 10 2022, 5:32 PM

LGTM but I am not a format expert.

ldionne accepted this revision.Aug 31 2022, 9:36 AM
This revision is now accepted and ready to land.Aug 31 2022, 9:36 AM
This revision was automatically updated to reflect the committed changes.