romainfrancois commented on pull request #11727:
URL: https://github.com/apache/arrow/pull/11727#issuecomment-972755825


   Should be fixed now. For the record, the relevant R code: 
https://github.com/r-devel/r-svn/blob/1a9b0f70744608548b8d6e7869c3930e3881edab/src/main/arithmetic.c#L793
   
   ```c
   static SEXP integer_unary(ARITHOP_TYPE code, SEXP s1, SEXP call)
   {
       R_xlen_t i, n;
       SEXP ans;
   
       switch (code) {
       case PLUSOP:
        return s1;
       case MINUSOP:
        ans = NO_REFERENCES(s1) ? s1 : duplicate(s1);
        int *pa = INTEGER(ans);
        const int *px = INTEGER_RO(s1);
        n = XLENGTH(s1);
        for (i = 0; i < n; i++) {
            int x = px[i];
            pa[i] = (x == NA_INTEGER) ?
                NA_INTEGER : ((x == 0.0) ? 0 : -x);
        }
        return ans;
       default:
        errorcall(call, _("invalid unary operator"));
       }
       return s1;                       /* never used; to keep -Wall happy */
   }
   ```


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