`float` — C Keyword
`float` — C Keyword
The float keyword in C: a single-precision IEEE 754 floating-point type.
`float` — C Keyword
The float keyword in C: a single-precision IEEE 754 floating-point type.
Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.
float (C)A single-precision floating-point type (IEEE 754 binary32, 32 bits), providing approximately 7 significant decimal digits.
float f;
float f = 3.14f; /* 'f' suffix for float literal */
#include <stdio.h>
#include <math.h>
int main(void) {
float r = 5.0f;
float area = 3.14159f * r * r;
printf("%.4f\n", area); /* 78.5397 */
/* Precision limits */
float x = 0.1f + 0.2f;
printf("%.10f\n", x); /* not exactly 0.3 */
return 0;
}
f suffix, a literal is double; assigning 3.14 to float narrows.-lm on POSIX systems when using <math.h> functions.int main() {
// Pick one facility from this reference page.
// Write the smallest program that exercises its main precondition,
// complexity rule, or lifetime constraint before scaling up.
return 0;
}