New submission from JohnSmith11132 <wbx96...@cuoly.com>:

Basically when squaring as a negative number, if it's a variable it acts like 
-3*-3 otherwise it acts like 3*-3.
For example:
>>> x = -3
>>> x ** 2
9
>>> -3 ** 2
-9

pow(-3, 2) seems to act like -3 * -3?
** 3 seems fine and both seems to act like -3*-3*-3.
>>> x = -3
>>> x ** 3
27
>>> -3 ** 3
-27

Will it be safe to use the ** 2 in Python? If I use a variable will it return 
the same value?

I only found this for the bug:
https://devforum.roblox.com/t/inconsistent-squaring-behavior/820028/

It looks like the exact same issue I'm having, but I still don't get it and 
it's not for Python.

----------
components: Interpreter Core
messages: 381573
nosy: JohnSmith11132
priority: normal
severity: normal
status: open
title: Inconsistent squaring behavior
type: behavior
versions: Python 3.10

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42428>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to