tkalkirill commented on code in PR #13375:
URL: https://github.com/apache/ignite/pull/13375#discussion_r3735640410


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/IgniteMath.java:
##########
@@ -411,7 +412,7 @@ else if (x instanceof Float) {
 
     /** */
     private static double extendToRound(double x) {
-        return x < 0.0d ? x - 0.5d : x + 0.5d;
+        return round(x).doubleValue();

Review Comment:
   Direct Java casts work correctly for the current 'RoundingMode.DOWN', but 
they implicitly hard-code this behavior. If 'IgniteTypeSystem.roundingMode()' 
is changed later, floating-point-to-integral conversions will no longer follow 
the configured rounding policy. Keeping the conversion through 'BigDecimal' 
makes the behavior consistent with the type system. However, changing the 
rounding mode would also require reviewing the overflow boundaries.



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

Reply via email to