bkietz commented on a change in pull request #9294: URL: https://github.com/apache/arrow/pull/9294#discussion_r571279697
########## File path: docs/source/cpp/compute.rst ########## @@ -744,3 +749,34 @@ Structural transforms * \(2) For each value in the list child array, the index at which it is found in the list array is appended to the output. Nulls in the parent list array are discarded. + +.. _common-numeric-type: + +Common numeric type +~~~~~~~~~~~~~~~~~~~ + +The common numeric type of a set of input numeric types is the smallest numeric +type which can accommodate any value of any input. If any input is a floating +point type the common numeric type is the widest floating point type among the +inputs. Otherwise the common numeric type is integral, is signed if any input +is signed, and its width is the maximum width of any input. For example: + ++-------------------+----------------------+-------------------------------------------+ +| Input types | Common numeric type | Notes | ++===================+======================+===========================================+ +| int32, int32 | int32 | | ++-------------------+----------------------+-------------------------------------------+ +| int16, int32 | int32 | Max width is 32, promote LHS to int32 | ++-------------------+----------------------+-------------------------------------------+ +| uint16, uint32 | uint32 | All inputs unsigned, maintain unsigned | ++-------------------+----------------------+-------------------------------------------+ +| uint16, int32 | int32 | One input signed, override unsigned | ++-------------------+----------------------+-------------------------------------------+ +| int16, uint32 | int32 | | Review comment: @jorisvandenbossche @pitrou I've adopted the suggested behavior of expanding integer width to accommodate anything except the extreme values of uint64. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org