[Numpy-discussion] __iadd__(ndarray<int>, ndarray<float>)

Travis E. Oliphant oliphant@enthought....
Mon Mar 24 23:54:51 CDT 2008


Andreas Klöckner wrote:
> On Montag 24 März 2008, Stéfan van der Walt wrote:
>   
>>>  I think this is highly undesirable and should be fixed, or at least
>>> warned about. Opinions?
>>>       
>> I know the result is surprising, but it follows logically.  You have
>> created two integers in memory, and now you add 0.2 and 0.1 to both --
>> not enough to flip them over to the next value.  The equivalent in C
>> is roughly:
>>     
>
> <snip>
>
> Thanks for the explanation. By now I've even found the fat WARNING in the 
> Numpy book. 
>
> I understand *why* this happens, but I still don't think it's a particular 
> sensible thing to do
>
> Question: If it's a known trap, why not change it?
>   
It also has useful applications.  Also, it can only happen at with a 
bump in version number to 1.1

-Travis O.




More information about the Numpy-discussion mailing list