github-actions[bot] commented on code in PR #64577:
URL: https://github.com/apache/doris/pull/64577#discussion_r3424475297


##########
be/src/exprs/function/cast/cast_to_string.h:
##########
@@ -118,8 +118,9 @@ struct CastToString {
                 end = fmt::format_to(buffer, FMT_COMPILE("{:.{}g}"), value,
                                      std::numeric_limits<float>::digits10 + 1);
             } else {
-                end = fmt::format_to(buffer, FMT_COMPILE("{:.{}g}"), value,
-                                     std::numeric_limits<double>::digits10 + 
1);
+                // shortest round-trip, fixed-precision %g would expose 
IEEE-754
+                // residual error e.g. round(23900/293, 2) -> 
"81.56999999999999".
+                end = fmt::format_to(buffer, FMT_COMPILE("{}"), value);

Review Comment:
   This changes `CastToString::from_number<double>` output, but the BE unit 
test expectations for this same path were not updated. 
`be/test/exprs/function/cast/cast_to_string.cpp` still expects 
`12345678901234567.12345 -> 1.234567890123457e+16`, `123456789012345678.12345 
-> 1.234567890123457e+17`, and `denorm_min -> 4.940656458412465e-324`, while 
this PR's generated regression output changed those spellings to 
`1.2345678901234568e+16`, `1.2345678901234568e+17`, and `5e-324`. The BE UT 
will fail once run. Please update the BE unit expectations, and any other 
intentional edge-value expected data, together with this formatter change.



-- 
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