Correct sign in modular exponentiation algorithm.

The modular exponentiation function  handled the sign
incorrectly. This commit fixes this and a test case which should have
caught it.
2 files changed