New submission from Martin Green <[EMAIL PROTECTED]>:

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 <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4224>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to