Skip to content

Commit

Permalink
ensure consistent results for gcdx(0,0) with BigInt
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj committed Nov 14, 2013
1 parent 07917e7 commit dc8652c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions base/gmp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ powermod(x::BigInt, p::Integer, m::BigInt) = powermod(x, BigInt(p), m)
powermod(x::BigInt, p::Integer, m::Integer) = powermod(x, BigInt(p), BigInt(m))

function gcdx(a::BigInt, b::BigInt)
if b == 0 # shortcut this to ensure consistent results with gcdx(a,b)
return a < 0 ? (-a,-one(BigInt),zero(BigInt)) : (a,one(BigInt),zero(BigInt))
end
g = BigInt()
s = BigInt()
t = BigInt()
Expand Down

0 comments on commit dc8652c

Please sign in to comment.