#include #include int main(){ float x=1.0; float toosmall=0; float toolarge=x; float oldaverage=0; for(int n=0;;n++){ float average=(toosmall+toolarge)/2; printf("Guess %d is %.17g\n",n+1,average); float xnew=x+average; if(xnew==x){ printf("\tWhich is too small!\n"); toosmall=average; } else { printf("\tWhich is too large!\n"); toolarge=average; } if(oldaverage==average) break; oldaverage=average; } printf("The largest epsilon such that x+epsilon=x\n"); printf("is %.17g\n",toosmall); return 0; }