We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f953153 commit 3f7ca67Copy full SHA for 3f7ca67
stl/inc/format
@@ -2145,6 +2145,8 @@ _NODISCARD _OutputIt _Fmt_write(
2145
case 'g':
2146
if (_Precision == -1) {
2147
_Precision = 6;
2148
+ } else if (_Precision == 0) {
2149
+ _Precision = 1;
2150
}
2151
_Format = chars_format::general;
2152
break;
tests/std/tests/P0645R10_text_formatting_formatting/test.cpp
@@ -835,6 +835,7 @@ void test_float_specs() {
835
assert(format(STR("{:3}"), Float{0}) == STR(" 0"));
836
assert(format(STR("{:#9G}"), Float{12.2}) == STR(" 12.2000"));
837
assert(format(STR("{:#12g}"), Float{1'000'000}) == STR(" 1.00000e+06"));
838
+ assert(format(STR("[{:#6.0g}]"), 1.234e-37) == STR("[1.e-37]"));
839
840
// Precision
841
Float value = 1234.52734375;
0 commit comments