Python gives me a different result if I assign one of the intermediate steps to a variable, like this:
>>> -0.207 ** 0.66 - 1
-1.3536229379434348
>>> a = -0.207
>>> a ** 0.66 - 1
(-1.1703591496008927+0.30988214273656856j)
For this simple calculation, if I assign -0.207
to a temporary variable a
, then the result of a ** 0.66 - 1
evaluates to a complex number.
Why does this happen, and how do I stop Python from doing that?