C examples for Data Type:double
Display each result three times:
include float.h and display the FLT_DIG and DBL_DIG .
#include <stdio.h> #include <float.h> int main(void) { /* w w w . jav a 2 s. c o m*/ 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; }