0

What is the difference between float and double?

10th Dec 2016, 1:38 AM
Venkata Anil Kumar Viswanadha
Venkata Anil Kumar Viswanadha - avatar
2 Respostas
+ 7
float is fewer bytes in size, and is more imprecise than double.
10th Dec 2016, 2:16 AM
Tamra
Tamra - avatar
+ 2
Float variables require, usually 4 bytes of memory to be stored while double variables needs 8 bytes. In general a double has 15 decimal digits of precision, while float has 7. This difference is to have more precision in storing data and perform calculations. The PI number for example is a infinite number, and calculations using PI are never totally accurate. So, in your simple homework you should use PI as 3.1415. But a engineer or NASA physicist would use a more accurate "PI form" like 3.14159265358979323. I recommend you to read this Stackoverflow topic if you want a different explanation: http://stackoverflow.com/questions/2386772/difference-between-float-and-double
10th Dec 2016, 3:44 AM
Rodrigo Monney
Rodrigo Monney - avatar