[Numpy-discussion] inconsistency in 10**(-2) or 10**array([-2])

Ralf Gommers ralf.gommers@googlemail....
Thu Aug 19 09:44:08 CDT 2010


On Wed, Aug 18, 2010 at 9:40 PM, Mark Bakker <markbak@gmail.com> wrote:

> I understand why numpy does it, but even Python itself gives 10**-2 = 0.01.
> So I am wondering whether this is the intended behavior of numpy. I don't
> really think so, but I may be wrong.
>
> Was intended, but should probably be changed:
http://projects.scipy.org/numpy/ticket/301
Would be good to make this decision and get it into 1.5.0.

Cheers,
Ralf



> > Roberto wrote:
> > I think the problem is that array([-2]) is an array of integers, so the
> result is also an array of integers. It works fine with array([-2.0]).
>
> On Wed, Aug 18, 2010 at 2:42 PM, Mark Bakker <markbak@gmail.com> wrote:
>
>> Hello list,
>>
>> When I do 10**-2, Python nicely returns 0.02
>>
>> But with numpy (version 1.3.0), I get zero:
>>
>> In [492]: 10**array([-2])
>> Out[492]: array([0])
>>
>> Is this the intended behavior?
>>
>> Thanks, Mark
>>
>>
>>
>>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100819/113aed8e/attachment.html 


More information about the NumPy-Discussion mailing list