emkornfield commented on a change in pull request #7885: URL: https://github.com/apache/arrow/pull/7885#discussion_r464575120
########## File path: cpp/src/gandiva/precompiled/arithmetic_ops.cc ########## @@ -234,6 +234,25 @@ DIV_FLOAT(float64) #undef DIV_FLOAT +#define ROUND(TYPE) \ + FORCE_INLINE \ + gdv_##TYPE round_##TYPE(gdv_##TYPE number, gdv_int32 place) { \ + if (number == 0) { \ + return 0; \ + } \ + if (number < 0) { \ + return -round_##TYPE(-number, place); \ + } \ + return floor(number * pow(10, place) + 0.5) * pow(10, -place); \ Review comment: it seems inefficient to use a floating point operations for integer values? Also for floats is special hanlding for inf/Nan necessary? ---------------------------------------------------------------- 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: us...@infra.apache.org