+ 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

4th Sep 2021, 12:15 PM
ENIOLA OLAWUNMI
ENIOLA OLAWUNMI - avatar
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
5th Sep 2021, 2:49 AM
Rishi
Rishi - avatar
+ 1
That was actually more explanatory I'm so grateful 🙋
7th Sep 2021, 12:49 AM
ENIOLA OLAWUNMI
ENIOLA OLAWUNMI - avatar
+ 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
30th Sep 2021, 3:18 PM
magic real
magic real - avatar
0
If you know how to use printf statement then try it self you will understood
4th Sep 2021, 12:45 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
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?
4th Sep 2021, 12:51 PM
ENIOLA OLAWUNMI
ENIOLA OLAWUNMI - avatar
0
ENIOLA OLAWUNMI Happy to help =)
7th Sep 2021, 3:08 AM
Rishi
Rishi - avatar