#ifdef __DECC #include #define __rpcc(x) __RPCC(x) extern int printf (const char * format, ...); #define M_PI 3.14159265358979323846 /* pi */ #elif defined __GNUC__ #define __rpcc(x) __builtin_alpha_rpcc(x) #include #include #else #error Unknown compiler #endif #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; unsigned int 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("%u,", (end - start) / iterations); return 0; }