0

# What is double variable type

2 Answers

+ 9

double is for floating-point or real numbers with optional decimal points and fractional parts in fixed or scientific notations, such as 3.1416, -55.66.
Better use the search function next time!
https://www.sololearn.com/Discuss/506244/what-does-double-mean-ex-double-x-3-14
https://www.sololearn.com/discuss/447874/

+ 9

Float (single precision floating point)
Double (double precision floating point)
So, what's the difference?
Well, that's all about how much you'd like a number being stored precisely in a variable. For example, you wanna store the value of Pi. Suppose that the float type is capable of holding a floating point number with 8 digits precision and double with 15 digits.
You are forcing to store Pi with 15-digit precision into a float type. Now, What's happening?
It narrows itself to fit into a float type
3.14159265
float pi1 = 3.141592653589793; // narrowed to 3.14159265
double pi2 = 3.141592653589793;