diff options
Diffstat (limited to 'charf.c')
| -rw-r--r-- | charf.c | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -266,6 +266,21 @@ int generate_each_charf(VALUETYPE* f, index_t i){ else return 0; } +int generate_infinity_example(VALUETYPE* f, index_t i){ + if(i==0){ + f[0] = int_to_valuetype(1); + f[1] = int_to_valuetype(1); + f[2] = int_to_valuetype(1); + f[3] = int_to_valuetype(0); + f[4] = int_to_valuetype(0); + f[5] = int_to_valuetype(1); + f[6] = int_to_valuetype(0); + f[7] = int_to_valuetype(0); + return 8; + } + else return -1; +} + int generate_triangle(VALUETYPE* f, index_t i){ int j = i+1; if(j <= N/2){ @@ -287,6 +302,7 @@ int generate_random(VALUETYPE* f, index_t i){ /*Writes into f the values of the function indexed by i. Returns the size of the support of f, or -1 if there is no function with that index.*/ int generate_function(VALUETYPE* f, index_t i){ return generate_each_charf(f,i); + //return generate_infinity_example(f,i); //return generate_random(f,i); //return generate_triangle(f,i); } @@ -331,8 +347,8 @@ void format_result(char* s, index_t index, int k, EXPTYPE p, VALUETYPE r, int fo } } for(int m=0; m+1<=k; m++){ - differentiate(df[(m+1)%2],df[m%2],d,1); - differentiate(dMf[(m+1)%2],dMf[m%2],d,1); + differentiate(df[m%2],df[(m+1)%2],d,1); + differentiate(dMf[m%2],dMf[(m+1)%2],d,1); l += sprintf(s+l,"\nf%d: ",m+1); for(int i=0; i<d; i++){ char v[8]; @@ -421,7 +437,7 @@ int compute(index_t index, EXPTYPE exponents[P], VALUETYPE (*records_ratio)[K+1] /*extra check for printing only because in error mode for some reason floats randomly seem to increase by tiny amounts*/ if(is_greater_certainly(r,(*records_ratio)[k][p])){ (*records_index)[k][p] = index; - char s[1024]; + char s[STRING_SIZE]; format_result(s, index, k, exponents[p], r, FORMAT_TEXT); printf("%s\n",s); } |
