Don't emit more than precision digits (#1072)

This commit is contained in:
Victor Zverovich
2019-03-09 13:53:23 -08:00
parent 3466d9c845
commit 49d244c065
3 changed files with 16 additions and 6 deletions
+1 -1
View File
@@ -2892,7 +2892,7 @@ void basic_writer<Range>::write_double(T value, const format_specs& spec) {
int exp = 0;
int precision = spec.has_precision() || !spec.type ? spec.precision : 6;
bool use_grisu = fmt::internal::use_grisu<T>() &&
!spec.type &&
(!spec.type || handler.fixed) &&
internal::grisu2_format(static_cast<double>(value), buffer,
precision, handler.fixed, exp);
if (!use_grisu) internal::sprintf_format(value, buffer, spec);