float_t, double_t
From cppreference.com
C
Concurrency support (C11)
Common mathematical functions
Functions
Basic operations
Maximum/minimum operations
(C23)
(C23)
(C23)
(C23)
(C23)
Exponential functions
Power functions
Trigonometric and hyperbolic functions
Nearest integer floating-point
Floating-point manipulation
Narrowing operations
Quantum and quantum exponent
(C23)
(C23)
(C23)
(C23)
Decimal re-encoding functions
(C23)
(C23)
(C23)
(C23)
Total order and payload functions
(C23)
(C23)
(C23)
(C23)
Classification
(C99)
(C23)
(C99)
(C99)
(C99)
(C99)
(C99)
(C23)
(C23)
(C99)
(C99)
(C99)
(C99)
(C99)
(C99)
(C23)
(C23)
Error and gamma functions
Types
(C99)(C99)
float_tdouble_t
(C99)(C99)
(C23)(C23)
Macro constants
Special floating-point values
(C99)(C99)(C23)
(C99)(C23)
(C99)(C23)
Arguments and return values
(C99)(C99)
(C99)(C99)(C99)(C99)(C99)
(C23)(C23)
(C23)(C23)(C23)(C23)(C23)
Error handling
(C99)(C99)
(C99)
Fast operation indicators
(C99)(C99)
(C23)(C23)(C23)(C23)
(C23)(C23)(C23)(C23)
(C23)(C23)(C23)(C23)
(C99)(C23)
(C23)(C23)(C23)(C23)
(C23)(C23)(C23)(C23)
(C23)(C23)(C23)(C23)
Defined in header
<math.h>
typedef /* implementation-defined */ float_t
(since C99)
typedef /* implementation-defined */ double_t
(since C99)
The types float_t and double_t are floating types at least as wide as float and double, respectively, and such that double_t is at least as wide as float_t. The value of FLT_EVAL_METHOD determines the types of float_t and double_t.
FLT_EVAL_METHOD
Explanation
0
float_t and double_t are equivalent to float and double, respectively
1
both float_t and double_t are equivalent to double
2
both float_t and double_t are equivalent to long double
other
both float_t and double_t are implementation defined
[edit] Example
Run this code
#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 = 1 sizeof(float) = 4 sizeof(float_t) = 8 sizeof(double) = 8 sizeof(double_t) = 8
[edit] References
- C23 standard (ISO/IEC 9899:2024):
- 7.12 Mathematics <math.h> (p: TBD)
- C17 standard (ISO/IEC 9899:2018):
- 7.12 Mathematics <math.h> (p: TBD)
- C11 standard (ISO/IEC 9899:2011):
- 7.12 Mathematics <math.h> (p: 231)
- C99 standard (ISO/IEC 9899:1999):
- 7.12 Mathematics <math.h> (p: 212)
[edit] See also
(C99)
(macro constant)