diff options
| -rw-r--r-- | charf.c | 8 | ||||
| -rw-r--r-- | ratio.c | 6 |
2 files changed, 6 insertions, 8 deletions
@@ -351,7 +351,6 @@ void* compute_chunk(void* arguments){ Args* args = arguments; int i = args -> num_thread; int* domain_current = args -> domain_current; - VALUETYPE f[N]; int d = 0; while(d >= 0){ d = compute(i, args -> exponents, args -> records_ratio, args -> records_index); @@ -363,10 +362,10 @@ void* compute_chunk(void* arguments){ } (*(args -> cont))++; if(*(args -> cont) >= NUM_THREADS) printf("Calculation finished. Press any button to stop.\n"); + return NULL; } int main() { - int num_exponents[K+1]; EXPTYPE exponents[P]; exponents[0] = int_to_exptype(1); exponents[1] = infinity_to_exptype(); @@ -377,7 +376,6 @@ int main() { int records_index[K+1][P]; for(int k=0; k<=K; k++) for(int p=0; p<P; p++) records_ratio[k][p] = int_to_valuetype(0); int domain_current = 0; - int result_code; int cont = 0; for (int i = 0; i < NUM_THREADS; i++) { @@ -388,7 +386,7 @@ int main() { args[i].num_thread = i; args[i].domain_current = &domain_current; args[i].cont = &cont; - result_code = pthread_create(&threads[i], NULL, compute_chunk, args+i); + pthread_create(&threads[i], NULL, compute_chunk, args+i); } size_t sz = 1024; @@ -409,7 +407,7 @@ int main() { // wait for each thread to complete for (int i = 0; i < NUM_THREADS; i++) { - result_code = pthread_join(threads[i], NULL); + pthread_join(threads[i], NULL); printf("In main: Thread %d has ended.\n", i); } @@ -127,20 +127,20 @@ rational absolute(rational r){ rational power(rational r, unsigned int p){ rational s = {0,1,1}; - for(int i = 1; i<= p; i++){ + for(unsigned int i = 1; i <= p; i++){ s = product(r,s); } return s; } int exptype_to_string(char *s, unsigned int p){ - if(exptype_is_infinite(p)) sprintf(s,"inf",p); + if(exptype_is_infinite(p)) sprintf(s,"inf"); else sprintf(s,"%d",p); return 0; } int exptype_to_latex(char *s, unsigned int p){ - if(exptype_is_infinite(p)) sprintf(s,"\\infty",p); + if(exptype_is_infinite(p)) sprintf(s,"\\infty"); else sprintf(s,"%d",p); return 0; } |
