Przejdź do głównej zawartości

std::float_t; std::double_t

Description

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

Declarations

Since C99
typedef /*implementation defined*/ float_t

typedef /*implementation defined*/ double_t

Examples

#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 Result
0
4 4
8 8

std::float_t; std::double_t

Description

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

Declarations

Since C99
typedef /*implementation defined*/ float_t

typedef /*implementation defined*/ double_t

Examples

#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 Result
0
4 4
8 8