Fix handling of thousands separator (#353)

(cherry picked from commit 0e6df7e511)
This commit is contained in:
Victor Zverovich authored and Jonathan Müller committed 2016-10-23 11:52:39 +02:00
1 parent 1127e7a953
commit 27f604a153
2 files changed
+5 -2

No files matched your search

+2 -1
View File
@@ -933,6 +933,7 @@ inline void format_decimal(Char *buffer, UInt value, unsigned num_digits,
}
unsigned index = static_cast<unsigned>(value * 2);
*--buffer = Data::DIGITS[index + 1];
thousands_sep(buffer);
*--buffer = Data::DIGITS[index];
}
@@ -2790,7 +2791,7 @@ void BasicWriter<Char>::write_int(T value, Spec spec) {
unsigned num_digits = internal::count_digits(abs_value);
fmt::StringRef sep = internal::thousands_sep(std::localeconv());
unsigned size = static_cast<unsigned>(
num_digits + sep.size() * (num_digits - 1) / 3);
num_digits + sep.size() * ((num_digits - 1) / 3));
CharPtr p = prepare_int_buffer(size, spec, prefix, prefix_size) + 1;
internal::format_decimal(get(p), abs_value, 0, internal::ThousandsSep(sep));
break;