Negative Base and Negative Exponent

Prolog is tricky: the arithmetic expression -2 ** 2 evaluates as 4.0 even though exponentiation does have precedence over negation. (I’m not sure why it goes to a float. It’s been a while since I knew these things.)

That’s because in Prolog the minus sign in -2 is not the negation operator but a part of literal syntax.

In the arithmetic expression -B ** 2, where the base is a variable, the minus sign is an operator. That expression is parsed as -(B ** 2) and maybe should not be spaced the way I did.