Improve error-checking.
[u/mdw/catacomb] / mp.h
diff --git a/mp.h b/mp.h
index 13bcd3d..dce8128 100644 (file)
--- a/mp.h
+++ b/mp.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: mp.h,v 1.4 1999/11/21 22:13:02 mdw Exp $
+ * $Id: mp.h,v 1.5 1999/11/22 20:50:37 mdw Exp $
  *
  * Simple multiprecision arithmetic
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mp.h,v $
+ * Revision 1.5  1999/11/22 20:50:37  mdw
+ * Add support for computing Jacobi symbols.
+ *
  * Revision 1.4  1999/11/21 22:13:02  mdw
  * Add mp version of MPX_BITS.
  *
@@ -639,6 +642,21 @@ extern void mp_div(mp **/*qq*/, mp **/*rr*/,
 extern void mp_gcd(mp **/*gcd*/, mp **/*xx*/, mp **/*yy*/,
                   mp */*a*/, mp */*b*/);
 
+/* --- @mp_jacobi@ --- *
+ *
+ * Arguments:  @mp *a@ = an integer less than @n@
+ *             @mp *n@ = an odd integer
+ *
+ * Returns:    @-1@, @0@ or @1@ -- the Jacobi symbol %$J(a, n)$%.
+ *
+ * Use:                Computes the Jacobi symbol.  If @n@ is prime, this is the
+ *             Legendre symbol and is equal to 1 if and only if @a@ is a
+ *             quadratic residue mod @n@.  The result is zero if and only if
+ *             @a@ and @n@ have a common factor greater than one.
+ */
+
+int mp_jacobi(mp */*a*/, mp */*n*/);
+
 /*----- Test harness support ----------------------------------------------*/
 
 #include <mLib/testrig.h>