diff options
Diffstat (limited to 'math.c')
-rw-r--r-- | math.c | 56 |
1 files changed, 56 insertions, 0 deletions
@@ -0,0 +1,56 @@ +#include <stdio.h> +#include <math.h> +#include <stdint.h> + +#define __rpcc __builtin_alpha_rpcc + +#define CPML "cpml" +#define GLIBC "glibc" + +#ifndef FUNCTION +#error Must define FUNCTION +#else +double FUNCTION(double); +#endif + +#ifndef DOMAIN_START +#error Must define RANGE_START +#endif + +#ifndef DOMAIN_END +#error Must define DOMAIN_END +#endif + +#ifndef INCREMENT +#define INCREMENT 0.1 +#endif + +int main(int argc, char * argv[]) { + double x; + double results[100]; + int i; + int iterations; + + uint64_t start, end; + + start = __rpcc(); + + for (i = 0, x = DOMAIN_START; x < DOMAIN_END; i++, x += INCREMENT) { + results[i] = FUNCTION(x); + } + + end = __rpcc(); + + iterations = i; + + if (argc != 1) { + for (i = 0; i < iterations; i++) { + printf("%f\n", results[i]); + } + } + +/* printf("%5s\t%5s\t%lu\n", LIB_NAME, FUNCTION_NAME, (end - start) / 30);*/ + printf("%lu,", (end - start) / iterations); + + return 0; +} |