The Floating Point data type is used to specify a variable that will contain real numbers, i.e. any positive or negative number with fractional part. The keyword used by C language to specify some variable as real is float. The width of memory allocated to floating point variable is 32 bits irrespective of the word size of the machine. The float data type can store real numbers with a precision of 6 digits. In order to store larger width floating point numbers with more precision, C provides double and long double floating point data types. The variable declared as double data type occupies 64 bits while the one declared as long double occupies 80 bits. Both also provide more precision as compared to float. It should be noted that float, double and long double only store signed real numbers. Table – 1 shows various variants of floating point data type along with their width and range.
Table – 1: Various forms of Floating Point data type in C