Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions stl/inc/format
Original file line number Diff line number Diff line change
Expand Up @@ -2145,6 +2145,8 @@ _NODISCARD _OutputIt _Fmt_write(
case 'g':
if (_Precision == -1) {
_Precision = 6;
} else if (_Precision == 0) {
_Precision = 1;
}
_Format = chars_format::general;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,7 @@ void test_float_specs() {
assert(format(STR("{:3}"), Float{0}) == STR(" 0"));
assert(format(STR("{:#9G}"), Float{12.2}) == STR(" 12.2000"));
assert(format(STR("{:#12g}"), Float{1'000'000}) == STR(" 1.00000e+06"));
assert(format(STR("[{:#6.0g}]"), 1.234e-37) == STR("[1.e-37]"));

// Precision
Float value = 1234.52734375;
Expand Down