summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2012-02-08 09:38:00 +0100
committerNiels Möller <nisse@lysator.liu.se>2012-02-08 09:38:00 +0100
commit35ee5f096c2e9c57e1554094925cf5c69837e71b (patch)
tree1f2001b6bfce9677c8a932e1b316363be84f4fa1 /doc
parent64d9495f6b6144601da9ae123e130dfe496710f2 (diff)
downloadgmp-35ee5f096c2e9c57e1554094925cf5c69837e71b.tar.gz
Clarified corner cases in cofactor canonicalization.
Diffstat (limited to 'doc')
-rw-r--r--doc/gmp.texi21
1 files changed, 16 insertions, 5 deletions
diff --git a/doc/gmp.texi b/doc/gmp.texi
index 2379813e3..59996dde2 100644
--- a/doc/gmp.texi
+++ b/doc/gmp.texi
@@ -3551,11 +3551,22 @@ Set @var{g} to the greatest common divisor of @var{a} and @var{b}, and in
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
-@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
-@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
-@math{@var{t} = sgn(@var{b})} if @var{a = 0}.
+@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 @math{@GMPabs{@var{t}} < @GMPabs{@var{a}}
+/ (2 @var{g})}, and these relations define @var{s} and @var{t} uniquely. There
+are a few exceptional cases:
+
+If @math{@GMPabs{@var{a}} = @GMPabs{@var{b}}}, then @math{@var{s} = 0},
+@math{@var{t} = sgn(@var{b})}.
+
+Otherwise, @math{@var{s} = sgn(@var{a})} if @math{@var{b} = 0} or
+@math{@GMPabs{@var{b}} = 2 @var{g}}, and @math{@var{t} = sgn(@var{b})} if
+@math{@var{a} = 0} or @math{@GMPabs{@var{a}} = 2 @var{g}}.
+
+In all cases, @math{@var{s} = 0} if and only if @math{@var{g} =
+@GMPabs{@var{b}}}, i.e., if @var{b} divides @var{a} or @math{@var{a} = @var{b}
+= 0}.
If @var{t} is @code{NULL} then that value is not computed.
@end deftypefun