Re: same_value casting in ndarray.astype
Marten van Kerkwijk via NumPy-Discussion <[email protected]>
| Newsgroups | gmane.comp.python.numeric.general |
|---|---|
| Message-ID | <[email protected]> |
I like the idea of adding "same_value" casting. I have added some comments to the PR. -- Marten matti picus via NumPy-Discussion <[email protected]> writes: > In PR 29129 I propose to add a new casting option to ndarray.astype(dtype, casting='XXX') called same_value. It changes the inner casting > loop to check that the value round-trips, and raises a value error on overflow or float-to-int truncation. While the PR adds infrastructure > for further same_value casting in user-defined dtypes and elsewhere in NumPy, the current work is only exposed in ndarray.astype (and > not in np.astype, since there is no casting option in that function). > > This was motivated by user desire to have some kind of value-based casting. > > See also the discussion of saturation-based ufuncs > > What do you think? > Matti _______________________________________________ NumPy-Discussion mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/numpy-discussion.python.org Member address: [email protected]