title: How big of a number can you store in double and float in c?
body: <p>I am trying to figure out exactly how big number I can use as floating point number and <code>double</code>. But it does not store the way I expected except integer value. <code>double</code> should hold 8 bytes of information which is enough to hold variable a, but it does not hold it right. It shows <code>1234567890123456768</code> in which last 2 digits are different. And when I stored <code>214783648</code> or any digit in the last digit in float variable <code>b</code>, it shows the same value <code>214783648</code>. which is supposed to be the limit. So what's going on?</p>
  
  <pre><code>double a;
  float b;
  int c;
  a = 1234567890123456789;
  b = 2147483648;
  c = 2147483647;
  printf("Bytes of double: %d\n", sizeof(double));
  printf("Bytes of integer: %d\n", sizeof(int));
  printf("Bytes of float: %d\n", sizeof(float));
  
  printf("\n");
  
  printf("You can count up to %.0f in 4 bytes\n", pow(2,32));
  printf("You can count up to %.0f with + or - sign in 4 bytes\n", pow(2,31));
  printf("You can count up to %.0f in 4 bytes\n", pow(2,64));
  printf("You can count up to %.0f with + or - sign in in 8 bytes\n", pow(2,63));
  
  printf("\n");
  
  printf("double number: %.0f\n", a);
  printf("floating point: %.0f\n", b);
  printf("integer: %d\n", c);
  
  return 0;
  </code></pre>