What is the difference between the 'float' and the 'double' data types ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the difference between the 'float' and the 'double' data types ?

also want to know the difference between '%lf' and '%lf' format specifiers .

21st Oct 2018, 9:49 AM
Mehedi Hasan
Mehedi Hasan - avatar
4 Answers
+ 3
The range between those data types varies. float: It occupies 4 bytes (32bits). double: It occupies 8 bytes(64bits).
21st Oct 2018, 4:58 PM
Deepak
Deepak - avatar
+ 1
float is type just with floating point, but double has double accuracy https://stackoverflow.com/a/27598164
21st Oct 2018, 10:17 AM
perevertysh
perevertysh - avatar
0
The precision. Double has a smaller margin of error.
21st Oct 2018, 4:03 PM
NicolasHM
NicolasHM - avatar
0
One data type occupies 4 bytes and another occupies 8 bytes. Is this the fundamental difference between 'float ' and 'double ? Is it so, then what will happen , if I use float instead of double?
23rd Oct 2018, 1:15 AM
Mehedi Hasan
Mehedi Hasan - avatar