modulus and signum functions