]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
factor: prime comments
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 1 Jul 2025 19:59:17 +0000 (12:59 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 10 Jul 2025 00:12:40 +0000 (17:12 -0700)
* src/factor.c: Add comments re prime functions.

src/factor.c

index b445dc21a502e40af2c92478e5ea87f39968b158..6b42dc76264c9a841c81c4e11843b55eaf7c9aa3 100644 (file)
@@ -1337,7 +1337,8 @@ static bool mp_prime_p (mpz_t);
    Baillie-PSW for single- and/or double-word args.  */
 enum { USE_BAILLIE_PSW = true };
 
-/* Is N prime?  */
+/* Is N prime?  N cannot be even or be a composite number less than
+   SQUARE_OF_FIRST_OMITTED_PRIME.  */
 static bool
 prime_p (mp_limb_t n)
 {
@@ -1425,7 +1426,8 @@ prime_p (mp_limb_t n)
     }
 }
 
-/* Is (n1,n0) prime, where n1 != 0?  */
+/* Is (n1,n0) prime?  (n1,n0) cannot be even or be a composite number
+   less than SQUARE_OF_FIRST_OMITTED_PRIME.  */
 static bool
 prime2_p (mp_limb_t n1, mp_limb_t n0)
 {
@@ -1529,7 +1531,8 @@ prime2_p (mp_limb_t n1, mp_limb_t n0)
     }
 }
 
-/* Is N prime, where B^2 / 2 <= N?  */
+/* Is N prime?  N cannot be even or be a composite number less than
+   SQUARE_OF_FIRST_OMITTED_PRIME.  */
 static bool
 mp_prime_p (mpz_t n)
 {