float_t, double_t
From cppreference.net
Common mathematical functions
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Definiert im Header
<math.h>
|
||
|
typedef
/* implementation-defined */
float_t
|
(seit C99) | |
|
typedef
/* implementation-defined */
double_t
|
(seit C99) | |
Die Typen float_t und double_t sind Gleitkommatypen, die mindestens so breit sind wie float bzw. double , und zwar so, dass double_t mindestens so breit ist wie float_t . Der Wert von FLT_EVAL_METHOD bestimmt die Typen von float_t und double_t .
FLT_EVAL_METHOD
|
Erklärung |
| 0 | float_t und double_t entsprechen float bzw. double |
| 1 | sowohl float_t als auch double_t entsprechen double |
| 2 | sowohl float_t als auch double_t entsprechen long double |
| other | sowohl float_t als auch double_t sind implementierungsdefiniert |
Beispiel
Diesen Code ausführen
#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)); }
Mögliche Ausgabe:
FLT_EVAL_METHOD = 1 sizeof(float) = 4 sizeof(float_t) = 8 sizeof(double) = 8 sizeof(double_t) = 8
Referenzen
- C23-Standard (ISO/IEC 9899:2024):
-
- 7.12 Mathematik <math.h> (S: TBD)
- C17-Standard (ISO/IEC 9899:2018):
-
- 7.12 Mathematik <math.h> (S: TBD)
- C11-Standard (ISO/IEC 9899:2011):
-
- 7.12 Mathematik <math.h> (S: 231)
- C99-Standard (ISO/IEC 9899:1999):
-
- 7.12 Mathematik <math.h> (S: 212)
Siehe auch
|
(C99)
|
gibt an, in welcher Genauigkeit alle arithmetischen Operationen durchgeführt werden
(Makrokonstante) |