From: Stefan v. d. W. <st...@su...> - 2006-09-28 10:29:57
|
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=E9fan |