[Gmp-commit] /var/hg/gmp: Clarified documentation of mpz_gcd and mpz_gcdext
mercurial at gmplib.org
mercurial at gmplib.org
Tue May 10 10:50:40 CEST 2011
details: /var/hg/gmp/rev/e15939b50ccd
changeset: 14180:e15939b50ccd
user: Niels M?ller <nisse at lysator.liu.se>
date: Tue May 10 10:50:25 2011 +0200
description:
Clarified documentation of mpz_gcd and mpz_gcdext
diffstat:
ChangeLog | 5 +++++
doc/gmp.texi | 15 +++++++++------
2 files changed, 14 insertions(+), 6 deletions(-)
diffs (44 lines):
diff -r 0ec95fc3fe72 -r e15939b50ccd ChangeLog
--- a/ChangeLog Mon May 09 21:38:01 2011 +0200
+++ b/ChangeLog Tue May 10 10:50:25 2011 +0200
@@ -1,3 +1,8 @@
+2011-05-10 Niels Möller <nisse at lysator.liu.se>
+
+ * doc/gmp.texi (mpz_gcd): Document that gcd(0,0) = 0.
+ (mpz_gcdext): Document range for cofactors.
+
2011-05-09 Niels Möller <nisse at lysator.liu.se>
* mpz/gcdext.c (mpz_gcdext): Increased sp allocation to bsize+1 limbs.
diff -r 0ec95fc3fe72 -r e15939b50ccd doc/gmp.texi
--- a/doc/gmp.texi Mon May 09 21:38:01 2011 +0200
+++ b/doc/gmp.texi Tue May 10 10:50:25 2011 +0200
@@ -3529,9 +3529,10 @@
@deftypefun void mpz_gcd (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
@cindex Greatest common divisor functions
@cindex GCD functions
-Set @var{rop} to the greatest common divisor of @var{op1} and @var{op2}.
-The result is always positive even if one or both input operands
-are negative.
+Set @var{rop} to the greatest common divisor of @var{op1} and @var{op2}. The
+result is always positive even if one or both input operands are negative.
+Except if both inputs are zero; then this function defines @math{gcd(0,0) =
+0}.
@end deftypefun
@deftypefun {unsigned long int} mpz_gcd_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
@@ -3551,9 +3552,11 @@
addition set @var{s} and @var{t} to coefficients satisfying
@math{@var{a}@GMPmultiply{}@var{s} + @var{b}@GMPmultiply{}@var{t} = @var{g}}.
The value in @var{g} is always positive, even if one or both of @var{a} and
- at var{b} are negative. The values in @var{s} and @var{t} are chosen such that
- at math{@GMPabs{@var{s}} @le{} @GMPabs{@var{b}}} and @math{@GMPabs{@var{t}}
- at le{} @GMPabs{@var{a}}}.
+ at var{b} are negative (or zero if both inputs are zero). The values in @var{s} and @var{t} are chosen such that
+normally, @math{@GMPabs{@var{s}} < @GMPabs{@var{b}} / (2 @var{g})} and
+ at math{@GMPabs{@var{t}} < @GMPabs{@var{a}} / (2 @var{g})}. The exceptional
+cases are that @math{@var{s} = sgn(@var{a})} if @math{@var{b} = 0} and
+ at math{@var{t} = sgn(@var{b})} if @var{b = 0}.
If @var{t} is @code{NULL} then that value is not computed.
@end deftypefun
More information about the gmp-commit
mailing list