danepitkin opened a new issue, #35563:
URL: https://github.com/apache/arrow/issues/35563

   ### Describe the enhancement requested
   
   See discussion found in https://github.com/apache/arrow/issues/34901.
   
   To summarize, safe casting of int64 to float64 for numerics greater than 
2^53 is currently not supported in Arrow. However, according to the 
Double-precision floating point format[1] defined in the IEEE 754-2008 
standard, there are certain integers that can be safely cast to floating point. 
From 2^54 to 2^55, the representable numbers are every 2^1. From 2^54 to 2^55, 
the representable numbers are every 2^2. From 2^55 to 2^56, the representable 
numbers are every 2^3, etc.
   
   
   18014398509481984 can be safely cast between int64 and float64 according to 
the IEEE 754-2008 standard, but not in arrow:
   ```
   >>> arr = pa.array([18014398509481984], type=pa.int64())
   >>> arr.cast(pa.float64())
   Traceback (most recent call last):
   ...
   pyarrow.lib.ArrowInvalid: Integer value 18014398509481984 not in range: 
-9007199254740992 to 9007199254740992
   ```
   
   [1] https://en.wikipedia.org/wiki/Double-precision_floating-point_format
   
   ### Component(s)
   
   C++


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