Update format-inl.h

This commit is contained in:
medithe 2018-08-28 09:31:50 +02:00 committed by GitHub
parent 009af3771d
commit d2741fd0e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -374,7 +374,7 @@ FMT_FUNC char *write_exponent(char *buffer, int exp) {
*buffer++ = '+';
}
if (exp >= 100) {
*buffer++ = '0' + static_cast<char>(exp / 100);
*buffer++ = static_cast<char>('0' + static_cast<char>(exp / 100));
exp %= 100;
const char *d = data::DIGITS + exp * 2;
*buffer++ = d[0];
@ -384,7 +384,7 @@ FMT_FUNC char *write_exponent(char *buffer, int exp) {
*buffer++ = d[0];
*buffer++ = d[1];
} else {
*buffer++ = '0' + static_cast<char>(exp);
*buffer++ = static_cast<char>('0' + static_cast<char>(exp));
}
return buffer;
}
@ -529,7 +529,7 @@ FMT_FUNC void grisu2_format(double value, char *buffer, size_t &size, char type,
size_t unsigned_precision = precision >= 0 ? precision : 6;
if (size > unsigned_precision) {
// TODO: round instead of truncating
dec_exp += size - unsigned_precision;
dec_exp += static_cast<int>(size - unsigned_precision);
size = unsigned_precision;
}
grisu2_prettify(buffer, size, dec_exp, type, unsigned_precision,