Skip to content

[C++][Compute] Add floor, ceiling, and truncate kernels #28487

Closed

Description

@asfimport

Kernels to round each value in an array of floating point numbers to:

  • the nearest integer less than or equal to it (floor)

  • the nearest integer greater than or equal to it (ceiling)

  • the integral part without fraction digits

    Should return an array of the same type as the input (not an integer type)

Reporter: Ian Cook / @ianmcook
Assignee: Eduardo Ponce / @edponce

Related issues:

PRs and other links:

Note: This issue was originally created as ARROW-12745. Please see the migration documentation for further details.

Activity

  1. asfimport commented on May 19, 2021

    @asfimport
    Author

    Eduardo Ponce / @edponce:
    These are special cases of the round kernels (ARROW-12744) or viceversa.

  2. asfimport commented on Jun 15, 2021

    @asfimport
    Author

    Eduardo Ponce / @edponce:
    @ianmcook why would ceiling/floor spec be to not return integral values? By definition their result is an integral value, and R and SQL both return an integer type. On the other hand, numpy returns float64.

  3. asfimport commented on Jun 15, 2021

    @asfimport
    Author

    Ian Cook / @ianmcook:
    @edponce I believe that is incorrect; R's ceiling and floor functions return numeric vectors (R's double type). In most SQL engines I've looked at, the ceil and floor functions return a column with the same type as the input.

  4. asfimport commented on Jun 15, 2021

    @asfimport
    Author

    Eduardo Ponce / @edponce:
    You are correct, I ran examples and R returns "double" type, and SQL engines match output to numeric type of input. I have no objection against this, and now recognize that my doubt arose from mixing the mathematical definition of an integral value with the type system of computing tools. Thanks!

  5. asfimport commented on Jul 16, 2021

    @asfimport
    Author

    David Li / @lidavidm:
    Issue resolved by pull request 10727
    #10727

  6. added this to the 5.0.0 milestone on Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions