0

My Python has started to imagine that square root of -1 is 1, so be careful with ** and unary -.

```
print (-1**0.5) ## ** binds stronger than unary minus!
i=-1
print "Square root of %i is %f" (i,i**0.5) # gives proper error
""" Output:
-1.0
Traceback (most recent call last):
File "D:/test/sqrt-1.py", line 4, in <module>
print "Square root of %i is %f" (i,i**0.5) # gives proper error
ValueError: negative number cannot be raised to a fractional power
"""
```

Also (and more difficult to see):

```
>>> i=1
>>> -i**0.5
-1.0
>>> (-i)**0.5
Traceback (most recent call last):
File "<pyshell#18>", line 1, in <module>
(-i)**0.5
ValueError: negative number cannot be raised to a fractional power
>>>
```

*Edited 6 Years Ago by pyTony*: n/a