Vladsz83 commented on code in PR #11635:
URL: https://github.com/apache/ignite/pull/11635#discussion_r1826981426


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/IgniteMath.java:
##########
@@ -308,17 +297,20 @@ public static short convertToShortExact(long x) {
 
     /** Cast value to {@code short}, throwing an exception if the result 
overflows an {@code short}. */
     public static short convertToShortExact(double x) {
-        if (x > Short.MAX_VALUE || x < Short.MIN_VALUE)
+        if (x < (Double)SHORT_BOUNDS[2] || x > (Double)SHORT_BOUNDS[3])
             throw new ArithmeticException(SMALLINT.getName() + " overflow");
 
-        return (short)x;
+        return (short)round(x);
     }
 
     /** Cast value to {@code short}, throwing an exception if the result 
overflows an {@code short}. */
     public static short convertToShortExact(Number x) {
-        checkNumberLongBounds(SMALLINT, x);

Review Comment:
   Attached v2 : https://github.com/apache/ignite/pull/11644



-- 
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: notifications-unsubscr...@ignite.apache.org

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

Reply via email to