...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <float.h> long double big_d; double d_a; double d_b; float f_a; float f_b; /* initializationsInitializations */ if (d_a > FLT_MAX || d_a < -FLT_MAX) { /* Handle error condition */ } else { f_a = (float)d_a; } if (big_d > FLT_MAX || big_d < -FLT_MAX) { /* Handle error condition */ } else { f_b = (float)big_d; } if (big_d > DBL_MAX || big_d < -DBL_MAX) { /* Handle error condition */ } else { d_b = (double)big_d; } |
...