Float Data Type In C++

Float Data Type ?

A floating-point data type is used to store real numbers such as 3 .28, 64. 755765, 8.01, -24.53. Floating Point data type is used for storing single precision floating point values or decimal values. Float variables typically requires 4 byte of memory space.


➦This data type includes float and double' data types. The various floating -point data types with their size and range are listed in Table.

➦Float is also used in situations that can tolerate rounding errors that occur due to the float precision of seven digits.

Syntax:

double num = 10098.98899;

Example 1:



Output :

   1.4013e-45
   0

Example 2:



Output :

    19.99

Example 3:



Output :

	Size of char : 1 byte
	Size of int : 4 bytes
	Size of short int : 2 bytes
	Size of long int : 8 bytes
	Size of signed long int : 8 bytes
	Size of unsigned long int : 8 bytes
	Size of float : 4 bytes
	Size of double : 8 bytes
	Size of wchar_t : 4 bytes