#include <stdio.h> /* for input/output */
#include <math.h> /* for pow */

main() {
  float y;
  int bits = 0; /* set bits to 0 */
  int base = 2; /* assume computer uses binary */
  do {
    bits++; /* increase number of bits known to exist */
    y = pow(base, bits+1); /* test next number of bits */ 
  } while (y != y+1); /* stop if 1 is no longer significant */
  printf ("C uses %d bytes for this floating point type, %d bits of which is the mantissa.\n", sizeof(y), bits);
}

/* OUTPUT:
C uses 52 bits for the mantissa of a double.
 */

/* This is what the documentation says! */

/* COMPILATION ERRORS 
"s3q5-2.c", line 10: syntax error before or at: y
cc: acomp failed for s3q5-2.c
 -- solved by linking in the math library
 */
