Monday, July 27, 2009

In C++, What's the difference between a 'float' and a 'double'?

float Floating point number.


double Double precision floating point number.





What does double precision do??????





Does float mean decimal?

In C++, What's the difference between a 'float' and a 'double'?
Floats and doubles both hold decimal numbers but the difference comes from what precision of numbers they can hold.





For example, a float can normally hold numbers that are roughly 7 digits long (3.141592) but doubles can normally hold numbers that are about 15 digits (3.14159265358979). That's a lot more precision!





The name "double" comes from the fact that in the computer, doubles take twice as much memory than floats.
Reply:Float and Double is used for storing decimal number. Float size is smaller ie we use double to store bigger decimal place and it also avoid loss of data. Float is a sigle precision and Float is double precision. If decimal number is smaller than use float rather than double because it occupy huge space and make program more time to load.


No comments:

Post a Comment