tchrist@convex.com (Tom Christiansen) (11/23/90)
On a Sun, these expressions return these values:
(-1) ** 1 1
(-1) ** 2 -1
(-1) ** 3 1
(-1) ** 4 -1
which is all well and good, and just as you want and expect.
However, on a Convex, I get this happy message out STDERR:
mth$d_pow: [303] power undefined with negative base
and a value of positive 1 is always returned.
Why the inconsistent behavior? How come Suns do it right and we don't?
I would blame our pow() function, but I'm wondering why Sun's is better.
(Or is it?)
Yes, I know I should write
(-1) ** $n
as
(($n % 2) ? -1 : 1)
and just stay clear of the ** operator, but that doesn't really
answer my question.
--tom