You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Eduardo Ponce (Jira)" <ji...@apache.org> on 2021/05/24 23:48:00 UTC

[jira] [Comment Edited] (ARROW-12861) [C++][Compute] Add sign function kernels

    [ https://issues.apache.org/jira/browse/ARROW-12861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17350633#comment-17350633 ] 

Eduardo Ponce edited comment on ARROW-12861 at 5/24/21, 11:47 PM:
------------------------------------------------------------------

IEEE 754 defines rules for +0.0 and -0.0, thus *sign(+0.0) = 1* and *sign(-0.0) = -1*. On the other hand, integral zero results in *sign(0) = 0*. Is this behavior reasonable?

This approach will result in different behavior for floating-point and integral operands.
 # Floating-point *sign(X) =*
*-1 if X <= -0.0*
*1 if X >= 0.0*
 # Integral *sign(X) =*
*-1 if X < 0*
*0 if X = 0*
*1 if X > 0*


was (Author: edponce):
IEEE 754 defines rules for +0.0 and -0.0, thus *sign(+0.0) = 1* and *sign(-0.0) = -1*. On the other hand, integral zero results in *sign(0) = 0*. Is this behavior reasonable?

> [C++][Compute] Add sign function kernels
> ----------------------------------------
>
>                 Key: ARROW-12861
>                 URL: https://issues.apache.org/jira/browse/ARROW-12861
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>            Reporter: Eduardo Ponce
>            Assignee: Eduardo Ponce
>            Priority: Major
>             Fix For: 5.0.0
>
>
> Add the sign function to the compute kernels.
> sign(X) =
>  * 1 if X > 0
>  * 0 if X = 0
>  * -1 if X < 0



--
This message was sent by Atlassian Jira
(v8.3.4#803005)