Commit bb3be0d
authored
fix
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`powermod correctness on unsigned power of half typemax (#59680)1 parent 694902b commit bb3be0d
2 files changed
+15
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
489 | 489 | | |
490 | 490 | | |
491 | 491 | | |
492 | | - | |
| 492 | + | |
493 | 493 | | |
494 | 494 | | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
504 | 506 | | |
505 | 507 | | |
506 | 508 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
362 | 365 | | |
363 | 366 | | |
364 | 367 | | |
| |||
0 commit comments