currently working my way through the superb CS:APP whereupon a curious question arose while doing some two's complement exercises.
GNU bc 1.06, default settings - no flags:
-2 ^ 3
-8
... but then ...
-2 ^ 4
16
Question
Why is -2 ^ 4 equal to positive 16? I plugged this into Google's calculator function, and I did indeed get -16.
I've probably left the lens cap of my mind on again (with respect to Pinky & the Brain), but any hints on this behaviour is appreciated.
Thanks
sc.