+ 2
How do I know what variable should be added to a float or what should be added to double precision
I don't understand how to allocate values to either of them. What makes the value of the variable different and makes it specific to a data value
6 ответов
+ 3
Float has less precision than double. For example, if you store a value "556677.1234567", a double gives you more precision than a float
https://code.sololearn.com/caUskvty4Tzl/?ref=app
As you can see here, the float data type deceased the precision(or rounded it) to store the big data into its relatively small size. On the other hand, double has a larger size and can store more accurate values than a float
+ 1
That was actually more explanatory I'm so grateful 🙋
+ 1
float is random number with a wild value to the last percent of it while double is a fixed number like a sum with no change 200$ is double , 200.45$ and cents is float
0
If you know how to use printf statement then try it self you will understood
0
Let me give an example: I came across a part where constant was defined using the value of PI 3.14 and it was given the data type of double.... so I was wondering why double and not float when float also deals with numbers with decimal fractions ? What makes
double PI = 3.14, different from float salary = 56.26?
0
ENIOLA OLAWUNMI
Happy to help =)