js8544 commented on code in PR #36289:
URL: https://github.com/apache/arrow/pull/36289#discussion_r1259131419


##########
docs/source/cpp/compute.rst:
##########
@@ -563,30 +563,34 @@ representation based on the rounding criterion.
 
+-------------------+------------+-------------+-------------------------+----------------------------------+--------+
 | floor             | Unary      | Numeric     | Float32/Float64/Decimal |     
                             |        |
 
+-------------------+------------+-------------+-------------------------+----------------------------------+--------+
-| round             | Unary      | Numeric     | Float32/Float64/Decimal | 
:struct:`RoundOptions`           | (1)(2) |
+| round             | Unary      | Numeric     | Input Type              | 
:struct:`RoundOptions`           | (1)(2) |
 
+-------------------+------------+-------------+-------------------------+----------------------------------+--------+
-| round_to_multiple | Unary      | Numeric     | Float32/Float64/Decimal | 
:struct:`RoundToMultipleOptions` | (1)(3) |
+| round_to_multiple | Unary      | Numeric     | Input Type              | 
:struct:`RoundToMultipleOptions` | (1)(3) |
 
+-------------------+------------+-------------+-------------------------+----------------------------------+--------+
 | trunc             | Unary      | Numeric     | Float32/Float64/Decimal |     
                             |        |
 
+-------------------+------------+-------------+-------------------------+----------------------------------+--------+
 
-* \(1) Output value is a 64-bit floating-point for integral inputs and the
-  retains the same type for floating-point and decimal inputs.  By default
-  rounding functions displace a value to the nearest integer using
-  HALF_TO_EVEN to resolve ties.  Options are available to control the rounding
-  criterion.  Both ``round`` and ``round_to_multiple`` have the ``round_mode``
-  option to set the rounding mode.
+* \(1)  By default rounding functions displace a value to the nearest 
+  integer using HALF_TO_EVEN to resolve ties.  Options are available to 
control 
+  the rounding criterion.  Both ``round`` and ``round_to_multiple`` have the 
+  ``round_mode`` option to set the rounding mode.
 * \(2) Round to a number of digits where the ``ndigits`` option of
   :struct:`RoundOptions` specifies the rounding precision in terms of number
   of digits.  A negative value corresponds to digits in the non-fractional
   part.  For example, -2 corresponds to rounding to the nearest multiple of
   100 (zeroing the ones and tens digits).  Default value of ``ndigits`` is 0
-  which rounds to the nearest integer.
+  which rounds to the nearest integer. For integer inputs a non-negative 
+  ``ndigits`` value is ignored and the input is returned unchanged. For integer
+  inputs, if ``-ndigits`` is larger than the maximum number of digits the 
+  input type can hold, it is truncated to the maximum digit. For example, 
+  ``round([123], ndigits=-4, round_mode=DOWN)`` returns [100] for ``int8`` 
type.

Review Comment:
   I agree that we should align with RoundToMultiple. I changed the behavior to 
rejecting the operation when -ndigits is too large.



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