Message350041
I don't have a problem with the trivial ring - I wasn't being that high-minded ;-) I was testing a different inverse algorithm, and in the absence of errors checked that
minv(a, m) * a % m == 1
for various a and m >= 0. Of course that failed using pow(a, -1, m) instead when m=1. Offhand, I couldn't imagine a plausible use case for finding an inverse mod 1 - and still can't ;-) In abstract algebra, sure - but for concrete numerical computation? Oh well.
In any case, testing
(minv(a, m) * a - 1) % m == 0
instead appears to work for all non-error cases. |
|
Date |
User |
Action |
Args |
2019-08-21 00:16:22 | tim.peters | set | recipients:
+ tim.peters, mark.dickinson, BTaskaya |
2019-08-21 00:16:22 | tim.peters | set | messageid: <1566346582.92.0.933388051482.issue37893@roundup.psfhosted.org> |
2019-08-21 00:16:22 | tim.peters | link | issue37893 messages |
2019-08-21 00:16:22 | tim.peters | create | |
|