+ 1
What is the difference between float and double in C language
3 Respostas
+ 3
a float variable contains 32 bits, while a double variable contains double bits, ie 64 bits. So the difference between the two is that a float variable is lighter than a double and is performed faster, but a double variable is more accurate and can make mathematical calculations more accurate than float.
+ 3
Both allows for floating point numbers but the floats (single precision) are usually 4 bytes (32 bits, 23 for the mantissa) therefore allowing for about 7 significant places while double (double precision) is usually twice that amount, 8 bytes (64 bits, 54 for the mantissa) for about 16 significant places [IEEE 754]
I would use floats for not so precise calculations and double for preciseness
0
Please use the search feature before posting, I'm sure this question had been discussed before 👍