On 23.07.2011 14:26, sam.hack...@sent.com wrote:
Ah, I see the problem, it's doing -(1**2), you need to put "(-1)**2". And, that's not a problem for the vector class, it's only because I modified my copy a little. OK, nevermind then.
On Sat, 23 Jul 2011 13:23 +0100, sam.hack...@sent.com wrote:
Well, when I type "-1**2" into Python, it returns -1. If I run "1**2 + -1**2" it returns 0. So, is there a bug in Python then? Running 2.6.6 on Ubuntu 10.10. Removing the if statement from get_angle fixed the angle problem for me, because of this.
On Sat, 23 Jul 2011 13:56 +0200, "DR0ID" <dr...@bluewin.ch> wrote:

Your mistake basically was that you assumed that -1 ** 2 == -1 which is not.


Hi again

yes, careful with -1**2 == -(1**2) and (-1)**2 , its not the same (and the ** operator precedes the - operator hence the -(1**2) if you type in -1**2).

To avoid that, you could use a variable:

a = -1

a**2 == 1

Glad you found out. :)

~DR0ID

Reply via email to