You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "westonpace (via GitHub)" <gi...@apache.org> on 2023/04/19 15:56:18 UTC

[GitHub] [arrow] westonpace commented on issue #34901: [Python] Inconsistent cast behavior between array and scalar for int64

westonpace commented on issue #34901:
URL: https://github.com/apache/arrow/issues/34901#issuecomment-1514979073

   > Look into allowing safe conversion from int <-> float for valid numbers larger than 2^53 (feature)
   
   The options within the C++ lib are very fine-grained already:
   
   ```
     bool allow_int_overflow;
     bool allow_time_truncate;
     bool allow_time_overflow;
     bool allow_decimal_truncate;
     bool allow_float_truncate;
     // Indicate if conversions from Binary/FixedSizeBinary to string must
     // validate the utf8 payload.
     bool allow_invalid_utf8;
   ```
   
   If we are discussing ideal behavior then I think something like...
   
   ```
   # Allow converting integers to floats when the integer cannot be exactly represented by
   # an IEEE-754 float and must be rounded.
   bool allow_float_inexact;
   ```
   
   ...would be very reasonable.  If we wanted to be even more extreme :smile: we could have:
   
   ```
   enum class IeeeRoundingMode : int8_t {
     TIE_TO_EVEN = 0,
     TIE_AWAY_FROM_ZERO = 1,
     TOWARD_ZERO = 2,
     TOWARD_POSITIVE_INFINITY = 3,
     TOWARD_NEGATIVE_INFINITY = 4,
     ERROR = 5
   };
   ```
   
   However, all of point number 3 sounds like a separate issue from this one.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org