/* * Calculate 'machine epsilon' * * To compile: * * make macheps * * or * * gcc -O0 macheps.c -o macheps * * or * * clang -O0 macheps.c -o macheps */ #include int main(void) { double x = 1.; int i = 0; while (x + 1. > 1.) { x /= 2; i += 1; } printf("Machine epsilon: %g\n", x); printf("Number of divisions: %d\n", i); return 0; }