C Standard Library

C <math.h> - double_t Type



The C <math.h> double_t type is an alias of one of the fundamental floating-point types at least as wide as double. It is the type used by the implementation to evaluate values of type double, as determined by FLT_EVAL_METHOD.

FLT_EVAL_METHODfloat_tdouble_t
0floatdouble
1doubledouble
2long doublelong double
otherimplementation-definedimplementation-defined

In the <math.h> header file, it is defined as follows:

typedef /* implementation-defined */ double_t;              

Example:

The example below shows the usage of double_t type.

#include <stdio.h>
#include <math.h>
#include <float.h>
 
int main (){

  printf("FLT_EVAL_METHOD: %d\n", FLT_EVAL_METHOD);
  printf("sizeof(float_t): %lu\n", sizeof(float_t));
  printf("sizeof(double_t): %lu\n", sizeof(double_t));
  printf("sizeof(float): %lu\n", sizeof(float));
  printf("sizeof(double): %lu\n", sizeof(double));
  printf("sizeof(long double): %lu\n", sizeof(long double));
  
  return 0;
}

The output of the above code will be:

FLT_EVAL_METHOD: 0
sizeof(float_t): 4
sizeof(double_t): 8
sizeof(float): 4
sizeof(double): 8
sizeof(long double): 16

❮ C <math.h> Library