You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/05/19 08:37:24 UTC

[GitHub] [arrow] kiszk commented on a change in pull request #10350: ARROW-12814: [C++][Gandiva] Implements the ABS, FLOOR, PI, SQRT, SIGN, LSHIFT, RSHIFT and TRUNC functions

kiszk commented on a change in pull request #10350:
URL: https://github.com/apache/arrow/pull/10350#discussion_r635030461



##########
File path: cpp/src/gandiva/precompiled/extended_math_ops.cc
##########
@@ -212,6 +230,32 @@ ENUMERIC_TYPES_UNARY(RADIANS, float64)
   }
 ENUMERIC_TYPES_UNARY(DEGREES, float64)
 
+// Abs
+#define ABS(IN_TYPE)                                                      \
+  FORCE_INLINE                                                            \
+  gdv_##IN_TYPE abs_##IN_TYPE(gdv_##IN_TYPE in) {                         \
+    return static_cast<gdv_##IN_TYPE>(abs(static_cast<long double>(in))); \

Review comment:
       I am curious whether all platforms can convert 64-bit integer to `long double` without loss of digits. (i.e. size(long double) > size(int64)).




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

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