Single precision

Single precision

In computing, single precision is a computer numbering format that occupies one storage location in computer memory at a given address. A single-precision number, sometimes simply a single, may be defined to be an integer, fixed point, or floating point.

Modern computers with 32-bit words (single precision) provide 64-bit double precision. "Single precision floating point" is an IEEE 754 standard for encoding floating point numbers that uses 4 bytes.

Single precision memory format

Sign bit: 1 Exponent width: 8 Significant precision: 23 (24 implicit)

The format is written with an implicit most-significant bit with value 1 unless the written exponent is all zeros. Thus only 23 bits of the fraction mantissa appear in the memory format but the total precision is 24 bits (better than 7 decimal digits, log_{10}(2^{24}) approx 7.225).

:

Exponent encoding

Emin (0x01) = -126 Emax (0xfe) = 127 Exponent bias (0x7f) = 127The true exponent = written exponent - exponent bias

0x00 and 0xff are reserved exponents 0x00 is used to represent zero and denormals 0xff is used to represent infinity and NaNs

All bit patterns are valid encoding.

Single precision examples in hexadecimal

3f80 0000 = 1

c000 0000 = -2

7f7f ffff ~ 3.4028234 x 1038 (Max Single) 3eaa aaab ~ 1/3By default, 1/3 rounds up instead of down like double precision, because of the even number of bits in the significant.So the bits beyond the rounding point are 1010... which is more than 1/2 of a unit in the last place.

0000 0000 = 0 8000 0000 = -0

7f80 0000 = Infinity ff80 0000 = -Infinity

Converting from single precision to human readable form

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 mantissa.

Sign bit: 0 Exponent: 1000 00112 = 8316 = 131 Mantissa: 100 1000 0000 0000 0000 00002 = 48000016

We then add the implicit 24th bit to the mantissa

Mantissa: 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 mantissa, 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 mantissa in this example has three bits set, bit 23, bit 22 and bit 19. We can now decode the mantissaby adding the values represented by these bits.

Decoded mantissa: 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

See also

* half precision – single precision – double precision – quadruple precision
* Floating point


Wikimedia Foundation. 2010.

Игры ⚽ Нужен реферат?

Look at other dictionaries:

  • Single Precision —   [dt. »einfache Genauigkeit«], Genauigkeit …   Universal-Lexikon

  • single precision — precision in which significant numbers are displayed by one computer term …   English contemporary dictionary

  • single precision — Computers. using one word rather than two or more to represent a number. Cf. double precision. * * * …   Universalium

  • single precision — Computers. using one word rather than two or more to represent a number. Cf. double precision …   Useful english dictionary

  • Single — may refer to:In music:* Single (music), a song release * Single (Natasha Bedingfield song), a 2004/2006 song by Natasha Bedingfield * Single coil, an electromagnetic guitar pickup type * Single (New Kids on the Block song), a 2008 single by New… …   Wikipedia

  • Precision (computer science) — In computer science, precision of a numerical quantity is a measure of the detail in which the quantity is expressed. This is usually measured in bits, but sometimes in decimal digits. It is related to precision in mathematics, which describes… …   Wikipedia

  • Precision bombing — is the desired skill of being able to bomb single buildings in a built up area, without causing any damage to the surrounding buildings, or the ability to place a bomb by air to within extremely accurate limits. Precision bombing was used by both …   Wikipedia

  • Precision-guided munition — Precision guided munitions (PGMs, smart munitions, smart bombs, guided bomb units or GBUs) are guided weapons intended to maximize damage to the target while minimizing civilian damage. Because the damage effects of an explosive weapon fall off… …   Wikipedia

  • Precision and recall — are two widely used measures for evaluating the quality of results in domains such as Information Retrieval and statistical classification.Precision can be seen as a measure of exactness or fidelity, whereas Recall is a measure of completeness.In …   Wikipedia

  • Single molecule electronics — is a branch of molecular electronics that uses single molecules as electronic components. Because single molecules constitute the smallest stable structures imaginable this miniaturization is the ultimate goal for shrinking electrical circuits.… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”