On Wed, 2022-06-01 at 18:37 -0500, Juan Nunez-Iglesias wrote: > > For example, in NumPy: > > > > np.median(np.float32([1, 2, 3, 4])) > > > > did return a float64 before and will now return a float32. I > > assume > > because somewhere we write: `(np.float64(3) + np.float32(2)) / 2`. > > Sorry, I missed this part of the discussion — I know the discussion > centered around Python literals being weak, but for NumPy dtypes, I > thought the larger dtype would always win?
Good reading carefully enough to notice :)! Sorry... my bad, the float64 is a typo. That should have read: (float32(3) + float32(2)) / 2 Which does show the change in behavior as described/discussed. If there was a float64 involved, of course the result would be/remain float64. - Sebastian > > Indeed, reading the NEP I see: > > Expression: array([1.], float32) + array(1., float64) > Old result: array([2.], float32) > New result: array([2.], float64) > > which seems to contradict your statement above? > _______________________________________________ > NumPy-Discussion mailing list -- numpy-discussion@python.org > To unsubscribe send an email to numpy-discussion-le...@python.org > https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ > Member address: sebast...@sipsolutions.net
signature.asc
Description: This is a digitally signed message part
_______________________________________________ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: arch...@mail-archive.com