|
|
|
Defined in header <math.h> | ||
typedef/* implementation-defined */ float_t | (since C99) | |
typedef/* implementation-defined */ double_t | (since C99) | |
The typesfloat_t anddouble_t are floating types at least as wide asfloat anddouble, respectively, and such thatdouble_t is at least as wide asfloat_t. The value ofFLT_EVAL_METHOD determines the types offloat_t anddouble_t.
FLT_EVAL_METHOD | Explanation |
0 | float_t anddouble_t are equivalent tofloat anddouble, respectively |
1 | bothfloat_t anddouble_t are equivalent todouble |
2 | bothfloat_t anddouble_t are equivalent tolongdouble |
other | bothfloat_t anddouble_t are implementation defined |
#include <float.h>#include <math.h>#include <stdio.h> #define SHOW(expr) printf("%s = %d\n", #expr, (int)(expr)) int main(){ SHOW(FLT_EVAL_METHOD); SHOW(sizeof(float)); SHOW(sizeof(float_t)); SHOW(sizeof(double)); SHOW(sizeof(double_t));}
Possible output:
FLT_EVAL_METHOD = 1sizeof(float) = 4sizeof(float_t) = 8sizeof(double) = 8sizeof(double_t) = 8
(C99) | specifies in what precision all arithmetic operations are done (macro constant) |