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

Float or double no difference?

In order to express decimal numbers we should use double data type because they have more precision. So can we say that we should avoid float and use double/long double only for decimal numbers?

3rd Jul 2016, 1:49 AM
Nikesh Prasad
4 Answers
+ 1
double store decimals and entire part in separate areas while float is converting the whole number in a power of two and.store it in the same area. In both case thoses numbers are limited in precision (for example due to decimal-to-binary conversion) so you have to use them carrefully in full knowledge of what you lose...
4th Jul 2016, 5:35 AM
Dorian
0
i think double take more memory than float so due to this for some code memory is unnecessaryily wasting
3rd Jul 2016, 3:27 AM
raju
raju - avatar
0
Double stores more zecimals.
4th Jul 2016, 9:52 PM
Mihai Dancaescu
Mihai Dancaescu - avatar
0
yes double take more memory.
5th Jul 2016, 4:36 AM
Dorian