You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/12/20 20:11:00 UTC

[GitHub] [doris] github-actions[bot] commented on a diff in pull request #15154: [Feature] Support function roundBankers

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


##########
be/src/exprs/math_functions.cpp:
##########
@@ -222,6 +222,22 @@ BigIntVal MathFunctions::round(FunctionContext* ctx, const DoubleVal& v) {
     return BigIntVal(static_cast<int64_t>(v.val + ((v.val < 0) ? -0.5 : 0.5)));
 }
 
+BigIntVal MathFunctions::round_bankers(FunctionContext* ctx, const DoubleVal& v) {
+    double fraction = v.val - std::floor(v.val);
+    if (fraction < 0.5) {
+        return BigIntVal(static_cast<int64_t>(std::floor(v.val)));
+    } else if (fraction > 0.5) {
+        return BigIntVal(static_cast<int64_t>(std::ceil(v.val)));
+    } else {
+        auto lower = floor(v.val);

Review Comment:
   warning: too few arguments to function call, expected 2, have 1; did you mean '::floor'? [clang-diagnostic-error]
   
   ```suggestion
           auto lower = ::floor(v.val);
   ```
   **/usr/include/x86_64-linux-gnu/bits/mathcalls.h:164:** '::floor' declared here
   ```cpp
   __MATHCALLX (floor,, (_Mdouble_ __x), (__const__));
                ^
   ```
   



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org