51 |
// Calculate the gcd of two integers using Euclid's classic |
// Calculate the gcd of two integers using Euclid's classic |
52 |
// algorithm and also display the intermediate results. |
// algorithm and also display the intermediate results. |
53 |
// c)"gmp_prob_prime" |
// c)"gmp_prob_prime" |
54 |
// Use Miller-Rabin to determine to high certainty whther a |
// Use Miller-Rabin to determine to high certainty whther a |
55 |
// number is prime or composite. |
// number is prime or composite. |
56 |
// d)"pfact_18" |
// d)"pfact_18" |
57 |
// Attempt to factor a number of 18 decimal digits or less into |
// Attempt to factor a number of 18 decimal digits or less into |
58 |
// component primes. |
// component primes. |
59 |
// e)"cfbrap" |
// e)"cfbrap" |
60 |
// Finds the best rational approximation to a rational number subject |
// Finds the best rational approximation to a rational number subject |
109 |
|
|
110 |
//Structure type used to hold the jump table of different functions |
//Structure type used to hold the jump table of different functions |
111 |
//to handle different subcommands. |
//to handle different subcommands. |
112 |
struct struct_ARITH_LARGE_CGI_subcmd_jmp |
struct struct_ARITH_LARGE_CGI_subcmd_jmp |
113 |
{ |
{ |
114 |
char *subfunc_string; |
char *subfunc_string; |
115 |
int (*subfunc_ptr)(int argc, char *argv[]); |
int (*subfunc_ptr)(int argc, char *argv[]); |
143 |
|
|
144 |
|
|
145 |
int main(int argc, char *argv[]) |
int main(int argc, char *argv[]) |
146 |
{ |
{ |
147 |
int i; |
int i; |
148 |
int rv = 0; |
int rv = 0; |
149 |
|
|
158 |
{ |
{ |
159 |
if (!strcmp(argv[1], subcmd_jump_tbl[i].subfunc_string)) |
if (!strcmp(argv[1], subcmd_jump_tbl[i].subfunc_string)) |
160 |
{ |
{ |
161 |
rv = (subcmd_jump_tbl[i].subfunc_ptr)(argc, argv); |
rv = (subcmd_jump_tbl[i].subfunc_ptr)(argc, argv); |
162 |
goto normal_return; |
goto normal_return; |
163 |
} |
} |
164 |
} |
} |
165 |
|
|
166 |
printf("Invalid subfunction code. Choices are:\n"); |
printf("Invalid subfunction code. Choices are:\n"); |