I fixed the overflow problem due to sqrt_mod1; added tests which previously failed also with OS with 64 bits.

I pushed the commit in my branch pr1. Is it fine or I have to open a new PR?