julia
3838dabb - Fix big(1)^big(-1) (#50821)

Commit
2 years ago
Fix big(1)^big(-1) (#50821) This PR gives BigInt exponentiation the same edge-case behavior as other integer exponentiation. The normal integer exponentiation checks if `x` is `1` or `-1` before erroring if the power is negative. https://github.com/JuliaLang/julia/blob/9f9e989f241fad1ae03c3920c20a93d8017a5b8f/base/intfuncs.jl#L283-L287 With this PR `big(1)^big(-1) == 1`, `big(-1)^big(-1) == -1` and `big(-1)^big(-2) == 1` --------- Co-authored-by: Sukera <11753998+Seelengrab@users.noreply.github.com>
Author
Parents
Loading