Right.
/ Henrik Grubbström (Lysator)
Previous text:
2002-10-15 16:13: Subject: Shifts
I'm suspecting the shift operators are not really up to spec:
case 1:
17<<-10;
(24) Result: 71303168
Gmp.mpz(17)<<Gmp.mpz(-10);
mpz->lsh on negative number. /pike/home/marcus/Pike/7.3/build/lib/modules/Gmp.so.mpz: 17->`<<(-10) HilfeInput:1: ___HilfeWrapper()
case 2:
(-10)>>30;
(39) Result: -1
(-10)>>31;
(40) Result: -1
(-10)>>32;
(41) Result: 0
Gmp.mpz(-10)>>Gmp.mpz(32);
(42) Result: -1
In the first case, shifting with a negative count should give an error just like the Gmp implementation.
In the second case, increasing the shift count should not suddenly change the value once it has stabilized on -1 (again, Gmp does the expected thing).
Right?
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)