Util: Pass floating-point precision to Format::Builder
This commit is contained in:
@@ -47,13 +47,23 @@ void Formatter<size_t>::format(Builder& builder, size_t value) const
|
|||||||
template<>
|
template<>
|
||||||
void Formatter<float>::format(Builder& builder, float value) const
|
void Formatter<float>::format(Builder& builder, float value) const
|
||||||
{
|
{
|
||||||
|
if (specifier.precision < 0) {
|
||||||
builder.putF32(value);
|
builder.putF32(value);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
builder.putF32(value, specifier.precision);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void Formatter<double>::format(Builder& builder, double value) const
|
void Formatter<double>::format(Builder& builder, double value) const
|
||||||
{
|
{
|
||||||
|
if (specifier.precision < 0) {
|
||||||
builder.putF64(value);
|
builder.putF64(value);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
builder.putF64(value, specifier.precision);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Char
|
// Char
|
||||||
|
|||||||
Reference in New Issue
Block a user