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

What is the difference between "double" and "float"?

11th May 2018, 2:59 PM
King Sam
King Sam - avatar
3 Answers
+ 3
" In most modern architectures, a float is 4 bytes, a double is 8, and a long double can be equivalent to a double (8 bytes), or 16 bytes. ..." Sources: https://www.sololearn.com/learn/CPlusPlus/1622/?ref=app https://www.sololearn.com/learn/1345/?ref=app "Difference between float and double in C/C++" https://www.geeksforgeeks.org/difference-float-double-c-cpp/
11th May 2018, 3:04 PM
Rahul George
Rahul George - avatar
+ 2
A small correction. On x86-64, the size of long double is 10 bytes (because that's how much the processor can handle). In ARM64 it's 8 byes.
11th May 2018, 3:32 PM
Vlad Serbu
Vlad Serbu - avatar
- 1
double alocate 2x more number info than float. so if a float uses 8bits,double use 16. if you don't have a small circuit with memory limitations, you can use double without any fear.
20th May 2018, 2:32 AM
Fernando Rodrigues C Cavalcante
Fernando Rodrigues C Cavalcante - avatar