Do you really believe that -0.1 ** 0.1 is a valid computational problem ? Can you raise a negative number to a fractional power ?<br>Output on my console (python 2.6)<br><br>>>> -.1 ** .1<br>-0.79432823472428149<br>

>>> a,b = -.1,.1<br>>>> a**b<br>Traceback (most recent call last):<br>  File "<stdin>", line 1, in <module><br>ValueError: negative number cannot be raised to a fractional power<br>

>>> -abs(a**b)<br>Traceback (most recent call last):<br>  File "<stdin>", line 1, in <module><br>ValueError: negative number cannot be raised to a fractional power<br><br>There is a little issue here that '>>> -.1 ** .1' should give you error message. That is it.<br>

<br><br><div class="gmail_quote">On Thu, Feb 11, 2010 at 6:14 AM, Terrence Cole <span dir="ltr"><<a href="mailto:list-sink@trainedmonkeystudios.org">list-sink@trainedmonkeystudios.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Can someone explain to me what python is doing here?<br>
<br>
Python 3.1.1 (r311:74480, Feb  3 2010, 13:36:47)<br>
[GCC 4.3.4] on linux2<br>
Type "help", "copyright", "credits" or "license" for more information.<br>
>>> -0.1 ** 0.1<br>
-0.7943282347242815<br>
>>> a = -0.1; b = 0.1<br>
>>> a ** b<br>
(0.7554510437117542+0.2454609236416552j)<br>
>>> -abs(a ** b)<br>
-0.7943282347242815<br>
<br>
Why does the literal version return the signed magnitude and the<br>
variable version return a complex?<br>
<br>
Cheers,<br>
Terrence<br>
<font color="#888888"><br>
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br>