[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Re: Bug report
From:       Peter Otten <__peter__ () web ! de>
Date:       2021-02-24 21:15:19
Message-ID: 4fef8d82-9747-2d8e-a564-861670e69656 () web ! de
[Download RAW message or body]

On 24/02/2021 22:03, Dan Stromberg wrote:
> On Wed, Feb 24, 2021 at 12:58 PM Peter Otten <__peter__@web.de> wrote:
> 
>> On 24/02/2021 20:36, Carla Molina wrote:
>> This is not a bug. Have a look at the array's dtype:
>>
>>   >>> n = 60461826
>>   >>> a = np.array([1, 50, 100, 150, 200, 250, 300])
>>   >>> a.dtype
>> dtype('int32')
>>
> I'm getting dtypes of float64.

When you run the snippet above or

> import numpy as np
> 
> NR = 0.25
> N = 60461826
> 
> initialINCIDENCE = np.array([1, 50, 100, 150, 200, 250, 300])
> initialINCIDENCE = initialINCIDENCE*N/(100000*7*NR)

here, i. e. after the division?

initialINCIDENCE*N

should be an int32 array, but dividing by

(100000*7*NR)

returns an dtype=float64 array. Switching back to my modified example:

 >>> a/42
array([0.02380952, 1.19047619, 2.38095238, 3.57142857, 4.76190476,
        5.95238095, 7.14285714])
 >>> _.dtype
dtype('float64')

-- 
https://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic