Skip to content
Closed
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
11 changes: 5 additions & 6 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -2402,12 +2402,11 @@ FMT_CONSTEXPR20 auto write_nonfinite(OutputIt out, bool isnan,
const bool is_zero_fill =
specs.fill_size() == 1 && specs.fill_unit<Char>() == '0';
if (is_zero_fill) specs.set_fill(' ');
return write_padded<Char>(out, specs, size,
[=](reserve_iterator<OutputIt> it) {
if (s != sign::none)
*it++ = detail::getsign<Char>(s);
return copy<Char>(str, str + str_size, it);
});
return write_padded<Char, align::right>(
out, specs, size, [=](reserve_iterator<OutputIt> it) {
if (s != sign::none) *it++ = detail::getsign<Char>(s);
return copy<Char>(str, str + str_size, it);
});
}

// A decimal floating-point number significand * pow(10, exp).
Expand Down
2 changes: 2 additions & 0 deletions test/format-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1622,6 +1622,7 @@ TEST(format_test, format_nan) {
EXPECT_EQ(fmt::format("{:<7}", nan), "nan ");
EXPECT_EQ(fmt::format("{:^7}", nan), " nan ");
EXPECT_EQ(fmt::format("{:>7}", nan), " nan");
EXPECT_EQ(fmt::format("{:7}", nan), " nan");
}

TEST(format_test, format_infinity) {
Expand All @@ -1639,6 +1640,7 @@ TEST(format_test, format_infinity) {
EXPECT_EQ(fmt::format("{:<7}", inf), "inf ");
EXPECT_EQ(fmt::format("{:^7}", inf), " inf ");
EXPECT_EQ(fmt::format("{:>7}", inf), " inf");
EXPECT_EQ(fmt::format("{:7}", inf), " inf");
}

TEST(format_test, format_long_double) {
Expand Down
Loading