Single-precision floating-point forma
Single-precision floating-point format is a computer number format that occupies 4 bytes (32 bits) in computer memory and represents a wide dynamic range of values by using a floating point.
In IEEE 754-2008 the 32-bit base 2 format is officially referred to as binary32. It was called single in IEEE 754-1985. In older computers, different floating-point formats of 4 bytes were used, e.g. GW-BASIC's single-precision data type was the 32-bit MBF floating-point format.
The IEEE 754 standard specifies a binary32 as having:
- Sign bit: 1 bit
- Exponent width: 8 bits
- Significand precision: 24 bits (23 explicitly stored)
The true significand includes 23 fraction bits to the right of the binary point and an implicit leading bit (to the left of the binary point) with value 1 unless the exponent is stored with all zeros. Thus only 23 fraction bits of the significand appear in the memory format but the total precision is 24 bits (equivalent to log10(224) ≈ 7.225 decimal digits). The bits are laid out as follows:
The real value assumed by a given 32 bit binary32 data with a given
biased exponent e (the 8 bit unsigned integer) and a 23 bit fraction
is
where more precisely we have
.
In this example:
thus: