summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorTorbjorn Granlund <tege@gmplib.org>2010-01-07 14:10:50 +0100
committerTorbjorn Granlund <tege@gmplib.org>2010-01-07 14:10:50 +0100
commitc8bfefa068b9e78f9690f1153378a693d35028be (patch)
treeb635ed3dcf21f34feeb0497aec3a1b58b75ef97d /doc
parent001bbe1099497b5cc83ef4b24bb383c3f1f1da15 (diff)
downloadgmp-c8bfefa068b9e78f9690f1153378a693d35028be.tar.gz
Update mpn_gcd, mpn_gcd_1, mpn_gcdext documentation.
Diffstat (limited to 'doc')
-rw-r--r--doc/gmp.texi44
1 files changed, 23 insertions, 21 deletions
diff --git a/doc/gmp.texi b/doc/gmp.texi
index ae8ed465b..9fb1fb11b 100644
--- a/doc/gmp.texi
+++ b/doc/gmp.texi
@@ -5359,30 +5359,30 @@ positive value if @math{@var{s1} > @var{s2}}, 0 if they are equal, or a
negative value if @math{@var{s1} < @var{s2}}.
@end deftypefun
-@deftypefun mp_size_t mpn_gcd (mp_limb_t *@var{rp}, mp_limb_t *@var{s1p}, mp_size_t @var{s1n}, mp_limb_t *@var{s2p}, mp_size_t @var{s2n})
-Set @{@var{rp}, @var{retval}@} to the greatest common divisor of @{@var{s1p},
-@var{s1n}@} and @{@var{s2p}, @var{s2n}@}. The result can be up to @var{s2n}
-limbs, the return value is the actual number produced. Both source operands
-are destroyed.
+@deftypefun mp_size_t mpn_gcd (mp_limb_t *@var{rp}, mp_limb_t *@var{xp}, mp_size_t @var{xn}, mp_limb_t *@var{yp}, mp_size_t @var{yn})
+Set @{@var{rp}, @var{retval}@} to the greatest common divisor of @{@var{xp},
+@var{xn}@} and @{@var{yp}, @var{yn}@}. The result can be up to @var{yn} limbs,
+the return value is the actual number produced. Both source operands are
+destroyed.
-@{@var{s1p}, @var{s1n}@} must have at least as many bits as @{@var{s2p},
-@var{s2n}@}. @{@var{s2p}, @var{s2n}@} must be odd. Both operands must have
-non-zero most significant limbs. No overlap is permitted between @{@var{s1p},
-@var{s1n}@} and @{@var{s2p}, @var{s2n}@}.
+@{@var{xp}, @var{xn}@} must have at least as many bits as @{@var{yp},
+@var{yn}@}. @{@var{yp}, @var{yn}@} must be odd. Both operands must have
+non-zero most significant limbs. No overlap is permitted between @{@var{xp},
+@var{xn}@} and @{@var{yp}, @var{yn}@}.
@end deftypefun
-@deftypefun mp_limb_t mpn_gcd_1 (const mp_limb_t *@var{s1p}, mp_size_t @var{s1n}, mp_limb_t @var{s2limb})
-Return the greatest common divisor of @{@var{s1p}, @var{s1n}@} and
-@var{s2limb}. Both operands must be non-zero.
+@deftypefun mp_limb_t mpn_gcd_1 (const mp_limb_t *@var{xp}, mp_size_t @var{xn}, mp_limb_t @var{ylimb})
+Return the greatest common divisor of @{@var{xp}, @var{xn}@} and @var{ylimb}.
+Both operands must be non-zero.
@end deftypefun
-@deftypefun mp_size_t mpn_gcdext (mp_limb_t *@var{gp}, mp_limb_t *@var{sp}, mp_size_t *@var{sn}, mp_limb_t *@var{up}, mp_size_t @var{un}, mp_limb_t *@var{vp}, mp_size_t @var{vn})
-Let @m{U,@var{U}} be defined by @{@var{up}, @var{un}@} and
-let @m{V,@var{V}} be defined by @{@var{vp}, @var{vn}@}.
+@deftypefun mp_size_t mpn_gcdext (mp_limb_t *@var{gp}, mp_limb_t *@var{sp}, mp_size_t *@var{sn}, mp_limb_t *@var{xp}, mp_size_t @var{xn}, mp_limb_t *@var{yp}, mp_size_t @var{yn})
+Let @m{U,@var{U}} be defined by @{@var{xp}, @var{xn}@} and let @m{V,@var{V}} be
+defined by @{@var{yp}, @var{yn}@}.
Compute the greatest common divisor @math{G} of @math{U} and @math{V}. Compute
a cofactor @math{S} such that @math{G = US + VT}. The second cofactor @var{T}
-is not calculated but can easily be obtained from @m{(G - US) / V, (@var{G} -
+is not computed but can easily be obtained from @m{(G - US) / V, (@var{G} -
@var{U}*@var{S}) / @var{V}} (the division will be exact). It is required that
@math{U @ge V > 0}.
@@ -5390,14 +5390,16 @@ is not calculated but can easily be obtained from @m{(G - US) / V, (@var{G} -
0} if and only if @math{V} divides @math{U} (i.e., @math{G = V}).
Store @math{G} at @var{gp} and let the return value define its limb count.
-Store @math{S} at @var{sp} and let |*@var{sn}| define its limb count. Some
-versions of GMP will make @math{S} negative; when this happens *@var{sn} will
-be negative. The areas at @var{gp} and @var{sp} should each have room for
-@math{@var{un}+1} limbs.
+Store @math{S} at @var{sp} and let |*@var{sn}| define its limb count. @math{S}
+can be negative; when this happens *@var{sn} will be negative. The areas at
+@var{gp} and @var{sp} should each have room for @math{@var{xn}+1} limbs.
-The areas @{@var{up}, @math{@var{un}+1}@} and @{@var{vp}, @math{@var{vn}+1}@}
+The areas @{@var{xp}, @math{@var{xn}+1}@} and @{@var{yp}, @math{@var{yn}+1}@}
are destroyed (i.e.@: the input operands plus an extra limb past the end of
each).
+
+Compatibility note: GMP 4.3.0 and 4.3.1 defined @math{S} less strictly.
+Earlier as well as later GMP releases define @math{S} as described here.
@end deftypefun
@deftypefun mp_size_t mpn_sqrtrem (mp_limb_t *@var{r1p}, mp_limb_t *@var{r2p}, const mp_limb_t *@var{sp}, mp_size_t @var{n})