Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
Mryange committed Mar 11, 2024
1 parent ad472eb commit 00c2328
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions be/src/gutil/strings/numbers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1281,11 +1281,8 @@ int FastDoubleToBuffer(double value, char* buffer, bool faster_float_convert) {
return jkj::dragonbox::to_chars_n(value, buffer) - buffer;
}

auto* end = fmt::format_to(buffer, FMT_COMPILE("{:.15g}"), value);
auto* end = fmt::format_to(buffer, FMT_COMPILE("{}"), value);
*end = '\0';
if (strtod(buffer, nullptr) != value) {
end = fmt::format_to(buffer, FMT_COMPILE("{:.17g}"), value);
}
return end - buffer;
}

Expand All @@ -1294,15 +1291,8 @@ int FastFloatToBuffer(float value, char* buffer, bool faster_float_convert) {
return jkj::dragonbox::to_chars_n(value, buffer) - buffer;
}

auto* end = fmt::format_to(buffer, FMT_COMPILE("{:.6g}"), value);
auto* end = fmt::format_to(buffer, FMT_COMPILE("{}"), value);
*end = '\0';
#ifdef _MSC_VER // has no strtof()
if (strtod(buffer, nullptr) != value) {
#else
if (strtof(buffer, nullptr) != value) {
#endif
end = fmt::format_to(buffer, FMT_COMPILE("{:.8g}"), value);
}
return end - buffer;
}

Expand Down

0 comments on commit 00c2328

Please sign in to comment.