Hi all,

Currently, the power function returns '0' for negative powers of
integers:

In [1]: N.power(3,-2)
Out[1]: 0

(or, more confusingly)

In [1]: N.power(a,b)
Out[1]: 0

which is almost certainly not the answer you want.  Two possible
solutions may be to upcast the input to float before calculation, or
to return nan.

This would be consistent with a function like sqrt:

In [10]: N.sqrt(3)
Out[10]: 1.7320508075688772

In [11]: N.sqrt(-3)
Out[11]: nan

Does anyone have an opinion on whether the change is necessary, and if
so, on which one would work best?

Regards
Stéfan

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to