The use of one computer word to hold a numeric value for calculation. Contrast with double precision.
Download Computer Desktop Encyclopedia to your iPhone/iTouch
| Computer Desktop Encyclopedia: single precision |
The use of one computer word to hold a numeric value for calculation. Contrast with double precision.
Download Computer Desktop Encyclopedia to your iPhone/iTouch
| 5min Related Video: Single precision floating-point format |
| Wikipedia: Single precision floating-point format |
In computing, single precision is a usually binary floating-point computer numbering format that occupies 4 bytes (32 bits in modern computers) in computer memory.
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, some older floating point format of 4 bytes was used.
One of the first programming languages to provide single- and double-precision floating-point data types was Fortran. Before the wide-spread adoption of IEEE 754-1985, the representation and properties of the double float data type depended on the computer manufacturer and computer model.
Single precision binary floating-point is used due to its wider range over fixed point (of the same bit-width), even if at the cost of precision.
Single precision is known as float in C, C++ and Java[1].
| IEEE 754 floating point precisions |
|---|
|
16-bit: Half (binary16) |
Contents |
The IEEE 754 standard specifies a binary32 as having:
The true significand includes an implicit leading bit with value 1 unless the exponent is stored with all zeros. Thus only 23 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 single precision binary floating-point exponent is encoded using an offset binary representation, with the zero offset being 127; also known as exponent bias in the IEEE 754 standard.
Thus, as defined by the offset binary representation, in order to get the true exponent the offset of 127 has to be subtracted from the stored exponent.
The stored exponents 0x00 and 0xff are interpreted specially.
| Exponent | Significand zero | Significand non-zero | Equation |
|---|---|---|---|
| 0x00 | zero, −0 | subnormal numbers | ![]() |
| 0x01, ..., 0xfe | normalized value | ![]() |
|
| 0xff | ±infinity | NaN (quiet, signalling) | |
The minimum positive (subnormal) value is 2−149 ≈ 1.4 × 10−45. The minimum positive normal value is 2−126 ≈ 1.18 × 10−38. The maximum representable value is (2−2−23) × 2127 ≈ 3.4 × 1038.
These examples are given in bit representation, in hexadecimal, of the floating point value. This includes the sign, (biased) exponent, and significand.
3f80 0000 = 1 c000 0000 = −2 7f7f ffff ≈ 3.4028234 × 1038 (max single precision) 0000 0000 = 0 8000 0000 = −0 7f80 0000 = infinity ff80 0000 = -infinity 3eaa aaab ≈ 1/3
By default, 1/3 rounds up instead of down like double precision, because of the even number of bits in the significand. So the bits beyond the rounding point are 1010... which is more than 1/2 of a unit in the last place.
We start with the hexadecimal representation of the value, 41c80000, in this example, and convert it to binary
41c8 000016 = 0100 0001 1100 1000 0000 0000 0000 00002
then we break it down into three parts; sign bit, exponent and significand.
Sign bit: 0 Exponent: 1000 00112 = 8316 = 131 Significand: 100 1000 0000 0000 0000 00002 = 48000016
We then add the implicit 24th bit to the significand
Significand: 1100 1000 0000 0000 0000 00002 = C8000016
and decode the exponent value by subtracting 127
Raw exponent: 8316 = 131 Decoded exponent: 131 - 127 = 4
Each of the 24 bits of the significand, bit 23 to bit 0, represents a value, starting at 1 and halves for each bit, as follows
bit 23 = 1 bit 22 = 0.5 bit 21 = 0.25 bit 20 = 0.125 bit 19 = 0.0625 . .
The significand in this example has three bits set, bit 23, bit 22 and bit 19. We can now decode the significand by adding the values represented by these bits.
Decoded significand: 1 + 0.5 + 0.0625 = 1.5625
Then we need to multiply with the base, 2, to the power of the exponent to get the final result
1.5625 × 24 = 25
Thus
41c8 0000 = 25
This is equivalent to:
where s is the sign bit, x is the exponent, and m is the significand.
This entry is from Wikipedia, the leading user-contributed encyclopedia. It may not have been reviewed by professional editors (see full disclaimer)
| Double precision | |
| AMD K6-III | |
| PDP-11 architecture |
Copyrights:
![]() | Computer Desktop Encyclopedia. THIS COPYRIGHTED DEFINITION IS FOR PERSONAL USE ONLY. All other reproduction is strictly prohibited without permission from the publisher. © 1981-2009 Computer Language Company Inc. All rights reserved. Read more | |
![]() | Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "Single precision floating-point format". Read more |