On Mon, Jun 13, 2016 at 12:07 PM, <josef.p...@gmail.com> wrote: > > > On Mon, Jun 13, 2016 at 11:51 AM, <josef.p...@gmail.com> wrote: > >> >> >> On Mon, Jun 13, 2016 at 11:25 AM, Antoine Pitrou <solip...@pitrou.net> >> wrote: >> >>> On Mon, 13 Jun 2016 10:49:44 -0400 >>> josef.p...@gmail.com wrote: >>> > >>> > My argument is that `**` is like integer division and sqrt where the >>> domain >>> > where integer return are the correct numbers is too small to avoid >>> > headaches by users. >>> >>> float64 has less integer precision than int64: >>> >>> >>> math.pow(3, 39) == 3**39 >>> False >>> >>> np.int64(3)**39 == 3**39 >>> True >>> >> >> but if a user does this, then ??? (headaches or head scratching) >> >> >>> np.array([3])**39 >> RuntimeWarning: invalid value encountered in power >> >> array([-2147483648], dtype=int32) >> > > I forgot to add > > the real headaches start in the second call, when we don't get the > RuntimeWarning anymore > > >>> np.array([4])**39 > array([-2147483648], dtype=int32) > > > ("Now, why do I owe so much money, when I made a huge profit all year." ) >
(grumpy off-topic complaint: The Canadian tax system is like this. They make a mistake in transferring information to a new computerized system, and then they send a bill for taxes based on reassessment of something that happened 5 years ago because their computerized record is wrong. ) > > Josef > > > >> >> Josef >> >> >>> >>> >>> (as a sidenote, np.float64's equality operator seems to be slightly >>> broken: >>> >>> >>> np.float64(3)**39 == 3**39 >>> True >>> >>> int(np.float64(3)**39) == 3**39 >>> False >>> >>> float(np.float64(3)**39) == 3**39 >>> False >>> ) >>> >>> Regards >>> >>> Antoine. >>> >>> >>> _______________________________________________ >>> NumPy-Discussion mailing list >>> NumPy-Discussion@scipy.org >>> https://mail.scipy.org/mailman/listinfo/numpy-discussion >>> >> >> >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion