From 771fe2354f90d30ae9a4d19e05ddda12e992cea8 Mon Sep 17 00:00:00 2001 From: twanmal Date: Thu, 6 Feb 2020 19:39:06 +0100 Subject: [PATCH] Update fp_isprime_ex.c removed failure due to trivial case where a is in primes --- src/numtheory/fp_isprime_ex.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/numtheory/fp_isprime_ex.c b/src/numtheory/fp_isprime_ex.c index 2b61f8c..c318cac 100644 --- a/src/numtheory/fp_isprime_ex.c +++ b/src/numtheory/fp_isprime_ex.c @@ -53,6 +53,10 @@ int fp_isprime_ex(fp_int *a, int t) /* do trial division */ for (r = 0; r < 256; r++) { + if (fp_cmp_d(a,primes[r])== FP_EQ) { + printf("a is in the table\n"); + return FP_YES; + } fp_mod_d(a, primes[r], &d); if (d == 0) { return FP_NO;