IEEE754 the representation of floating-point numbers. The expression range of float type data in C language is -3.4*10^38~+3.4*10^38. Double is -1.7*10^-308~1.7*10^308,long double for -1.2*10^-4932~1.2*10^4932.
Type |
Number of bits (bits) |
Valid numbers |
Range of values |
Float |
32 |
6~7 |
-3.4*10^38~+3.4*10^38 |
Double |
64 |
15~16 |
-1.7*10^-308~1.7*10^308 |
Long double |
128 |
18~19 |
-1.2*10^-4932~1.2*10^4932 |
Long double input: scanf ("%lf", &x); printf ("%.10LF", X);
In addition, the analysis of the use of memory consumption of arrays.
The int float is a 32-bit, or 4b=32bit
When you open an array of 10^7, the memory consumed is: 10^7*4B=39063KB=38MB
Short int is 16 bits, 10^7 array requires 19MB memory
Bool,char is a 8-bit, 10^7 array requires approximately 10MB of memory
Long long,double is 64 bits,10^7 array requires approximately 72MB of memory
A long double is 128 bits, and the10^7 array requires about 144MB of memory
Double,long double and array of variables memory overhead