显示每个结果三次:

  • 显示小数点右边的4位数,
  • 显示小数点右边的12位数字,
  • 显示小数点右侧的16位数字。

包括float.h并显示FLT_DIGDBL_DIG

#include <stdio.h>  
#include <float.h>  

int main(void)  
{  
    float ot_f = 1.0 / 3.0;  
    double ot_d = 1.0 / 3.0;  
    printf(" float values: ");  
    printf("%.4f %.12f %.16f\n", ot_f, ot_f, ot_f);  
    printf("double values: ");  
    printf("%.4f %.12f %.16f\n", ot_d, ot_d, ot_d);  
    printf("FLT_DIG: %d\n", FLT_DIG);  
    printf("DBL_DIG: %d\n", DBL_DIG);  
    return 0;  
}