/*
** savage.c -- floating point speed and accuracy test.  C version
** derived from BASIC version which appeared in Dr. Dobb's Journal,
** Sep. 1983, pp. 120-122.
*/

#define ILOOP  25000

#include <stdio.h>
#include <time.h>
#include <math.h>

void main(void) {
	int i;
	double a;

        printf("start\n");
        clock_t starttime = clock();
        a = 1.0;
        for (i = 1; i <= (ILOOP - 1); i++)
                a = tan(atan(exp(log(sqrt(a*a))))) + 1.0;
        printf("%ld 1/%dths of a second\n",clock()-starttime, CLOCKS_PER_SEC);
        printf("a = %20.14e\n", a);
        printf("done\n");
	}
