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

#include <stdio.h>
#include <float.h>
int main (void) {
float f_var = 1.0 / 3.0;
double d_var = 1.0 / 3.0;
printf("float: %18.4f double: %18.4g\n", f_var, d_var);
printf("float: %18.12f double: %18.12g\n", f_var, d_var);
printf("float: %.16f double: %.16g\n", f_var, d_var);
printf("FLT_DIG: %16d DBL_DIG: %17d \n", FLT_DIG, DBL_DIG);
return 0;
}