Invalid ^ operator operands

In an expression whose operator is the exponentiation operator (^), the pair of operands is invalid.

The expression X ^ Y (the base X raised to the exponent Y) cannot be evaluated when

  • X is 0, and Y is negative or 0: for example, 0 ^ -2
  • X is negative, and Y is not an integer: for example, -1 ^ 2.2

Respecify the expression, or the computations leading up to it, to ensure that the operands will have legal values when the ^ operator is applied to them.