Branch: Tag:

2003-08-07

2003-08-07 15:19:14 by Martin Nilsson <mani@lysator.liu.se>

Improved.

Rev: lib/modules/Int.pmod:1.3

4:   //! parity is odd 1 is returned. If it is even 0 is   //! returned.   int(0..1) parity(int(0..) value) { -  return String.count(sprintf("%b",value),"1")&1; +  if(value<0) error("Parity can not determined for negative values.\n"); +  return Gmp.mpz(value)->popcount()&1;   }