kirit.thadaka at gmail.com
Tue Jan 29 03:00:50 EST 2019
You are seeing negative numbers because of an overflow beyond 32 bits. Change the type of your np array to int64 using a = (np.arange(2000) ** 3).astype(np.int64) and you won’t see negative numbers. I assume you are running this code on a 32 bit machine which is why Numpy is defaulting to int32. On a 64 bit machine it defaults to int64.
Hope this helps.
> On Jan 28, 2019, at 11:22 PM, Yuping Wang <wyupinghhu at 163.com> wrote:
> Dear Nmupy developers and users:
> I am a new user of Numpy ,I have encountered a question about Numpy recently, which need your help. The question is below:
> I don know why there are negative numbers
> can somebody explain to me why these happens
> Thanks in advance!
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion