what is double ??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is double ???

can someone pkease explain what double means and when it is used , but can you explain it with simple words not fancy pro explanations :D thx

13th Aug 2016, 9:22 AM
Martin Milanov
Martin Milanov - avatar
2 Answers
+ 3
As you know, for integer values, we use int datatype. Like int a = 55; into b = 124; But, for numeric values WITH floating points, (like 5.66) we have two options. Using the "float" datatype or the "double" datatype. So, what's the difference between them? float covers up to 7 digits and uses 32 bits of memory. While, double covers about 16 digits but uses 64 bits of memory. It's more common to use double instead of float but keep in mind it uses more memory. So for very large projects (which I don't think you'll be doing anything soon!) be careful. As for you question, double is a datatype for declaring numeric variables with floating points. And it's used when we need to store numbers with floating points in a variable. Like: double x = 56.87; double y = 323.456;
13th Aug 2016, 10:05 AM
Alireza M
Alireza M - avatar
0
If I'm correct, it's basically a much more precise float data type, but in turn uses more memory.
13th Aug 2016, 10:05 AM
Aadam Zocolo
Aadam Zocolo - avatar