Commit 767f5660 authored by Bodigrim's avatar Bodigrim Committed by Ben Gamari

Fix gcdExtInteger (trac#15350)

(cherry picked from commit 7c207c86)
parent c3e50b05
......@@ -1389,7 +1389,9 @@ gcdExtSBigNat x y = case runS go of (g,s) -> (# g, s #)
where
go = do
g@(MBN# g#) <- newBigNat# gn0#
s@(MBN# s#) <- newBigNat# (absI# xn#)
-- According to https://gmplib.org/manual/Number-Theoretic-Functions.html#index-mpz_005fgcdext
-- abs(s) < abs(y) / (2 g)
s@(MBN# s#) <- newBigNat# (absI# yn#)
I# ssn_# <- liftIO (integer_gmp_gcdext# s# g# x# xn# y# yn#)
let ssn# = narrowGmpSize# ssn_#
sn# = absI# ssn#
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment