HappenLee commented on code in PR #31583:
URL: https://github.com/apache/doris/pull/31583#discussion_r1509905198


##########
be/src/vec/functions/round.h:
##########
@@ -222,15 +224,43 @@ class BaseFloatRoundingComputation<Float64> {
 
     static VectorType prepare(size_t scale) { return load1(scale); }
 };
+// for float number use round up or bankers
+template <typename T, TieBreakingMode tie_breaking_mode>
+class BaseFloatRoundingComputation<T, RoundingMode::Round, tie_breaking_mode> {
+public:
+    using ScalarType = T;
+    using VectorType = T;
+    static const size_t data_count = 1;
+
+    static VectorType load(const ScalarType* in) { return *in; }
+    static VectorType load1(const ScalarType in) { return in; }
+    static VectorType store(ScalarType* out, ScalarType val) { return *out = 
val; }
+    static VectorType multiply(VectorType val, VectorType scale) { return val 
* scale; }
+    static VectorType divide(VectorType val, VectorType scale) { return val / 
scale; }
+    template <RoundingMode mode>
+    static VectorType apply(VectorType val) {
+        if constexpr (tie_breaking_mode == TieBreakingMode::Bankers) {
+            return nearbyintf(val);

Review Comment:
   ScalarType* val;
   val1 val2
   VectorType res;
   ScalaType* res_t;
   



-- 
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-unsubscr...@doris.apache.org

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


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

Reply via email to