jonkeane commented on a change in pull request #11355:
URL: https://github.com/apache/arrow/pull/11355#discussion_r727124078



##########
File path: r/R/expression.R
##########
@@ -215,7 +215,7 @@ build_expr <- function(FUN,
     } else if (FUN == "%/%") {
       # In R, integer division works like floor(float division)
       out <- build_expr("/", args = args)
-      return(out$cast(int32(), allow_float_truncate = TRUE))
+      return(nse_funcs$floor(out))

Review comment:
       Have you tried calling the floor call (to do the truncation we are 
looking for) and then the casting the output of floor? (without allowing 
truncation) to see if that works? When we first implemented this, we were using 
the fact that `allow_float_truncate = TRUE` effectively did the truncation we 
were looking for.
   
   Though looking at what R does with negative numbers, we might actually want 
`round()` here:
   
   ```
   > 3 %/% 2
   [1] 1
   > -3 %/% 2
   [1] -2
   ```




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