+ 1

What is the difference between float and double in C language

4th Oct 2019, 3:53 AM
SPIDER
SPIDER - avatar
3 Réponses
+ 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.
4th Oct 2019, 4:07 AM
Wardy Spirit
Wardy Spirit - avatar
+ 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
4th Oct 2019, 4:04 AM
jtrh
jtrh - avatar
0
Please use the search feature before posting, I'm sure this question had been discussed before 👍
4th Oct 2019, 4:04 AM
Ipang