[Chapel Merge] Fix bug with implementation of `bigint.pow()` when

Branch: refs/heads/main
Revision: a0c4280
Author: lydia-duncan
Log Message:

Merge pull request #18412 from lydia-duncan/powBug

Fix bug with implementation of bigint.pow() when the exponent is negative
[reviewed by @mppf and a bit by @bradcray]

The original implementation was calling bigint.powm() under the covers when
the exponent was negative, sending the base argument again as the mod
argument - however, through testing via Wolfram Alpha there were many cases
where sending the base as the mod value would result in a different result,
and actually calling the bigint.mod method in these cases would result in
segfaults. Instead, since a negative exponent results in a fractional value for
all bases except 1 and -1, return 0 for most bases and return the base itself
when the base is 1. When the base is -1, return -1 when the exponent is odd and
1 when the exponent is even.

Resolves #17704

Add a test of negative exponents with bigint.pow(). This test segfaulted prior
to this change. It now passes.

Passed a full paratest with futures

Modified Files:
A test/library/standard/GMP/powCheck.chpl

A test/library/standard/GMP/powCheck.good
M modules/standard/BigInteger.chpl

Compare: https://github.com/chapel-lang/chapel/compare/490a136a46e0...a0c4280aa157