math/big: Exp does not handle negative exponents correctly #25865
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?Go 1.10
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?linux_amd64
What did you do?
When using package math/big, specifically big.Int.Exp(), I found that it cannot handle negative exponents correctly but simply returns 1.
What did you expect to see?
Compared to ModPow() in Java, Exp(x, y, z) should return mod inverse of (x ^ Abs(y)) mod N when y is negative.
What did you see instead?
Exp(x, y, z) simply returns 1 when y is negative.
The text was updated successfully, but these errors were encountered: