//this is an implementation of the exercise on p.25 of Landau //this program will try to determine the machine precision of the // running computer system within a factor of 2 //this program will output three columns of ASCII numbers // and one can plot them with any graphic package #include long counter; FILE *outfile; main() { double eps; double one; //initializing variables eps=1.0; counter=0; //initializing output date file outfile=fopen("machine.dat","w"); do { eps=eps/2.0; one=1.0+eps; counter++; fprintf(outfile,"%ld\t%22.18lg\t%lg\n",counter,one,eps); } while (one > 1.0); //this while loop will continue until 'one' is indistinguishable from 1.0 printf("Machine precision reached at %ld step\n",counter); printf("\tepslion value is %lg\n",eps); return 0; }