mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-31 11:17:35 +02:00
Replace use_grisu with fallback since Grisu is only one of multiple implemented algorithms
This commit is contained in:
@ -2676,7 +2676,7 @@ struct float_specs {
|
|||||||
bool upper : 1;
|
bool upper : 1;
|
||||||
bool locale : 1;
|
bool locale : 1;
|
||||||
bool binary32 : 1;
|
bool binary32 : 1;
|
||||||
bool use_grisu : 1;
|
bool fallback : 1;
|
||||||
bool showpoint : 1;
|
bool showpoint : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2375,7 +2375,7 @@ FMT_HEADER_ONLY_CONSTEXPR20 int format_float(Float value, int precision,
|
|||||||
return -precision;
|
return -precision;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!specs.use_grisu) return snprintf_float(value, precision, specs, buf);
|
if (specs.fallback) return snprintf_float(value, precision, specs, buf);
|
||||||
|
|
||||||
if (!is_constant_evaluated() && precision < 0) {
|
if (!is_constant_evaluated() && precision < 0) {
|
||||||
// Use Dragonbox for the shortest format.
|
// Use Dragonbox for the shortest format.
|
||||||
|
@ -1995,7 +1995,7 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value,
|
|||||||
++precision;
|
++precision;
|
||||||
}
|
}
|
||||||
if (const_check(std::is_same<T, float>())) fspecs.binary32 = true;
|
if (const_check(std::is_same<T, float>())) fspecs.binary32 = true;
|
||||||
fspecs.use_grisu = is_fast_float<T>();
|
if (!is_fast_float<T>()) fspecs.fallback = true;
|
||||||
int exp = format_float(promote_float(value), precision, fspecs, buffer);
|
int exp = format_float(promote_float(value), precision, fspecs, buffer);
|
||||||
fspecs.precision = precision;
|
fspecs.precision = precision;
|
||||||
auto fp = big_decimal_fp{buffer.data(), static_cast<int>(buffer.size()), exp};
|
auto fp = big_decimal_fp{buffer.data(), static_cast<int>(buffer.size()), exp};
|
||||||
|
Reference in New Issue
Block a user