yiguolei commented on code in PR #54760:
URL: https://github.com/apache/doris/pull/54760#discussion_r2281115381


##########
be/src/util/to_string.h:
##########
@@ -99,49 +99,18 @@ inline int fast_to_buffer(T value, char* buffer) {
             end = buffer + neg_inf_str_len;
         }
     } else {
-        end = fmt::format_to(buffer, FMT_COMPILE("{}"), value);
+        if constexpr (std::is_same_v<T, float>) {
+            end = fmt::format_to(buffer, FMT_COMPILE("{:.{}g}"), value,
+                                 std::numeric_limits<float>::digits10 + 1);
+        } else if constexpr (std::is_same_v<T, double>) {
+            end = fmt::format_to(buffer, FMT_COMPILE("{:.{}g}"), value,
+                                 std::numeric_limits<double>::digits10 + 1);
+        } else {

Review Comment:
   这个else 里,还包括什么东西? 比如包括日期?decimal? 还是啥? 如果是这些的话,这个fmt 是啥行为呢?
   如果我们这里只支持float/double的to string,感觉就没必要else了?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to