[New-bugs-announce] [issue4224] ** operating incorrectly for negative bases?
Martin Green
report at bugs.python.org
Tue Oct 28 22:53:14 CET 2008
New submission from Martin Green <martin.speleo at gmail.com>:
I suspect that the following behavior is incorrect:
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
(Intel)] on win32
>>> -1**2
-1
>>> -2**2
-4
>>> -1**0.5
-1.0
The same happens when the base is a float.
I have not checked out the functionality of other versions of python
The function pow (which claims to be equivalent to **) works as I would
expect:
>>> pow(-1, 2)
1
>>> pow(-2, 2)
4
>>> pow(-1, 0.5)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: negative number cannot be raised to a fractional power
I was not sure which components to select, please change them if I got
it wrong.
----------
assignee: theller
components: Tests, ctypes
messages: 75304
nosy: martin.speleo, theller
severity: normal
status: open
title: ** operating incorrectly for negative bases?
type: behavior
versions: Python 2.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4224>
_______________________________________
More information about the New-bugs-announce
mailing list