Logged In: YES
user_id=72053
If b<0 uses egcd, then pow(4,-1,6) should definitely throw a
value error, like dividing by 0. Pow isn't advertised as
computing gcd's. It just happens that egcd is a way of
computing inverses mod n.
I'm fine with 3-arg pow throwing an error on non-integer
args. I like that better than unexpected conversions.
How about continuing to throw an error on b<0, but adding
an egcd function to the math library?
What got me started on this was wanting a modular inverse,
not remembering how egcd worked and having to figure it
out again, and realizing I've been thru that same exercise
many times over the years :-).
|