Sunday, October 2, 2011

What is the difference between float and double datatypes?

float datatype:
Memory size 4 bytes. float is a short form for single precision floating point number. It is a 32-bit precision.
float represents upto 7 digits accurately after decimal point.
         float pi= 3.141F;
double datatype:
Memory size 8 bytes. double is a short form for double precision floating point number.it is a 64 bit precision.
double represents upto 15 digits accurately after decimal point.
         double distance = 1.98e^8;
more about data types click here 

No comments:

Post a Comment