[
https://issues.apache.org/jira/browse/ARROW-9253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17191768#comment-17191768
]
Antoine Pitrou edited comment on ARROW-9253 at 9/7/20, 3:58 PM:
----------------------------------------------------------------
Though it seems precision issues may be tricky.
{code:python}
>>> k = 86400_000_000_000; x = 123 * k
>>> (x * math.ceil(2**64 / k)) >> 64
123
>>> k = 86400_000_000_000; x = 106751 * k
>>> (x * math.ceil(2**64 / k)) >> 64
106751
>>> k = 86400_000_000_000; x = -106751 * k
>>> (x * math.ceil(2**64 / k)) >> 64
-106752
>>> (x * math.floor(2**64 / k)) >> 64
-106751
>>> k = 86400_000_000_000; x = -3 * k
>>> (x * math.ceil(2**64 / k)) >> 64
-4
>>> (x * math.floor(2**64 / k)) >> 64
-3
{code}
was (Author: pitrou):
Though it seems precision issues will be tricky to solve.
> [C++] Add vectorized "IntegersMultipleOf" to arrow/util/int_util.h
> ------------------------------------------------------------------
>
> Key: ARROW-9253
> URL: https://issues.apache.org/jira/browse/ARROW-9253
> Project: Apache Arrow
> Issue Type: Improvement
> Components: C++
> Reporter: Wes McKinney
> Priority: Major
> Fix For: 2.0.0
>
>
> There are various places where we check whether an array of integers are all
> a multiple of another number (e.g. a multiple of 86400000 milliseconds per
> day). It would be better to factor out this data check into a reusable
> function similar to the {{CheckIntegersInRange}} function
--
This message was sent by Atlassian Jira
(v8.3.4#803005)