julia
bb3be0dc - fix `powermod` correctness on unsigned power of half typemax (#59680)

Commit
98 days ago
fix `powermod` correctness on unsigned power of half typemax (#59680) the comment claims: > When the concrete type of p is signed and has the lowest value, > `p != 0 && p == -p` is equivalent to `p == typemin(typeof(p))` this is true, but fails to consider that `p == -p` is also true when `p = div(typemax(UInt), 2) + 1`, and that `p` is not necessarily signed leading to incorrect results on inputs like ``` julia> powermod(0x03, 0x80, 0x07) 0x01 ``` which should be `0x02`
Author
Parents
Loading