fixed ``sqrt_mod`` for negative modulus
Merge pull request #2430 from pernici/pr3

fixed ``sqrt_mod`` for negative modulus