pitrou opened a new pull request, #35997:
URL: https://github.com/apache/arrow/pull/35997

   The original algorithm for real-to-decimal conversion did its computations 
in the floating-point domain, accumulating rounding errors especially for large 
scale or precision values, such as:
   ```
   >>> pa.array([1234567890.]).cast(pa.decimal128(38, 11))
   <pyarrow.lib.Decimal128Array object at 0x7f05f4a3f1c0>
   [
     1234567889.99999995904
   ]
   >>> pa.array([1234567890.]).cast(pa.decimal128(38, 12))
   <pyarrow.lib.Decimal128Array object at 0x7f05f494f9a0>
   [
     1234567890.000000057344
   ]
   ```
   
   The new algorithm strives to avoid precision loss by doing all its 
computations in the decimal domain. However, negative scales, which are 
presumably infrequent, fall back on the old algorithm.
   


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