Learning by doing: Reading books and trying to understand the (code) examples
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
369 B

  1. #include <stdio.h>
  2. #include <float.h>
  3. int main (void) {
  4. float f_var = 1.0 / 3.0;
  5. double d_var = 1.0 / 3.0;
  6. printf("float: %18.4f double: %18.4g\n", f_var, d_var);
  7. printf("float: %18.12f double: %18.12g\n", f_var, d_var);
  8. printf("float: %.16f double: %.16g\n", f_var, d_var);
  9. printf("FLT_DIG: %16d DBL_DIG: %17d \n", FLT_DIG, DBL_DIG);
  10. return 0;
  11. }