You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Difference in hexadecimal floating-point (a) format between fmt and std isn't documented #4657
When formatting floating-point numbers to hexadecimal (a) format, fmt includes the 0x prefix (similar to printf%a), but std doesn't (specified in terms of to_chars). Perhaps std should be fixed.
changed the title [-]Difference in hexadecimal floating-point (`a`) format bewteen `fmt` and `std` isn't documented[/-][+]Difference in hexadecimal floating-point (`a`) format between `fmt` and `std` isn't documented[/+]on Jan 22, 2026
I think it's an unintentional change in std::format caused by switching to std::to_chars in one of the revisions of P0645. The reference implementation of std::format always printed 0x like pretty much every other facility and I missed the fact that std::to_chars does something different. The <charconv> paper doesn't mention it so it's unclear why it went with this "innovation". @statementreply, could you by any chance submit an LWG issue?
https://godbolt.org/z/TaK4s5YTM
When formatting floating-point numbers to hexadecimal (
a) format,fmtincludes the0xprefix (similar toprintf%a), butstddoesn't (specified in terms ofto_chars).Perhapsstdshould be fixed.