Weird result in power operator

The - operator has lower precedence than the ^ operator, so the expression -1.9345e6^1.5 means -(1.9345e6^1.5) rather than (-1.9345e6)^1.5. If you try the a = -1.9345e6; a^1.5 version in Matlab you’ll get the same imaginary value as complex(a)^1.5 gives in Julia.

Also, please quote code in posts:

5 Likes