Namespaces
Variants
Views
Actions

float_t, double_t

From cppreference.com
< c‎ | numeric‎ | math
 
 
 
Common mathematical functions
Types
(C99)(C99)    

float_tdouble_t
(C99)(C99)    

Functions
Basic operations
(C99)
(C99)
(C99)
(C99)(C99)(C99)(C23)
Maximum/minimum operations
(C99)
(C23)    
Exponential functions
(C23)
(C99)
(C99)
(C23)
(C23)
(C99)
(C99)(C23)
(C23)
(C23)
Power functions
(C99)
(C23)
(C23)
(C99)
(C23)
(C23)
Trigonometric and hyperbolic functions
(C23)
(C23)
(C23)
(C23)
(C99)
(C99)
(C99)
Error and gamma functions
(C99)
(C99)
(C99)
(C99)
Nearest integer floating-point operations
(C99)(C99)(C99)
(C99)
(C99)(C99)(C99)
(C23)(C23)(C23)(C23)
Floating-point manipulation functions
(C99)(C99)
(C99)(C23)
(C99)
Narrowing operations
(C23)
(C23)
(C23)
(C23)
(C23)
(C23)
Quantum and quantum exponent functions
Decimal re-encoding functions
Total order and payload functions
Classification
(C99)
(C99)
(C99)
(C23)
Macro constants
Special floating-point values
(C99)(C23)
Arguments and return values
(C99)(C99)(C99)(C99)(C99)    
Error handling
(C99)    

 
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

#include <float.h>
#include <math.h>
#include <stdio.h>
 
int main(void)
{
    printf("%d\n", FLT_EVAL_METHOD);
    printf("%zu  %zu\n", sizeof(float),sizeof(float_t));
    printf("%zu  %zu\n", sizeof(double),sizeof(double_t));
    return 0;
}

Possible output:

0
4  4
8  8

[edit] References

  • 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

use of extended precision for intermediate results: 0 not used, 1 double is used instead of float, 2: long double is used
(macro constant)