summaryrefslogtreecommitdiff
path: root/charf.c
diff options
context:
space:
mode:
Diffstat (limited to 'charf.c')
-rw-r--r--charf.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/charf.c b/charf.c
index 5aabe94..8911ffe 100644
--- a/charf.c
+++ b/charf.c
@@ -4,13 +4,21 @@
#include <pthread.h>
#include <assert.h>
-#ifndef EXACT
-#define EXACT false
+#define DOUBLEMODE 0
+#define DOUBLEERRORMODE 1
+#define RATIOMODE 2
+
+#ifndef MODE
+#define MODE DOUBLEMODE
#endif
#define NUM_THREADS 6
-#if EXACT
+#if MODE == DOUBLEERRORMODE
+#include "double-error.h"
+#define VALUETYPE double_error
+#define EXPTYPE double_error
+#elif MODE == RATIOMODE
#include "ratio.h"
#define VALUETYPE rational
#define EXPTYPE unsigned int
@@ -173,7 +181,9 @@ void compute(EXPTYPE p, int t){
printf("f: ");
for(int i=0;i<D;i++) printf("%1.0f ",to_double(f[i]));
printf("\n");
- printf("%.4f\n",to_double(r));
+ char s[128];
+ to_string(s,r);
+ printf("%.4f (%s)\n",to_double(r),s);
}
}
@@ -194,7 +204,7 @@ void* perform_work(void* arguments){
int main() {
/*exponent p of the L^p norm to consider*/
- EXPTYPE p = 1;
+ EXPTYPE p = to_exptype(1);
/*Iterate over all strings of 0s and 1s with length N. Those will represent f.*/
int t = 1;