Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How many digits are reserved for float type in C language?
How many digits are reserved for float type in C language?
By default, the float type has 6 digits after the decimal point. If you want to output a number or other numbers, you can output them in the following form:

Printf("%。 (Enter the number of digits to be output here) f ",x);

If one bit is output: printf("%. 1f ",x);

Precise Numbers of Floating Point in Extended Data C Language

example

# include & ltstdio.h & gt

# include & ltfloat.h & gt?

int main()

{

?

Printf ("Maximum number of bytes stored printf("float: %lu \n", sizeof(float)););

Printf ("floating point minimum: %E\n", FLT _ minimum); ?

Printf ("floating point maximum: %E\n", FLT _ maximum); ?

Printf ("precision value: %d\n", FLT _ dig); ?

Returns 0;

}