Float vs. Double | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Float vs. Double

I don't know the difference between both. just know that their values may vary after some decimal points even if you assign both same value after decimal point. maybe I'm wrong. please tell all the differences between both and when should I use either and why?

12th Mar 2017, 3:55 PM
Mahendra Aanjna
Mahendra Aanjna - avatar
2 ответов
+ 16
one difference of size Float occupies: 4 bytes and Double occupies: 8 bytes
12th Mar 2017, 4:02 PM
Mansi Dagla
Mansi Dagla - avatar
+ 4
Float holds decimal values, up to 4bits size, and Double holds up to (duuh) double the size, 8 bits. Float holds numbers with up to 7 decimal digits, while double holds up to 15 decimal digits
12th Mar 2017, 4:52 PM
Orfeo Terkuci
Orfeo Terkuci - avatar