Categories
  Encyclosphere.org ENCYCLOREADER
  supported by EncyclosphereKSF

Exponent bias

From HandWiki - Reading time: 3 min

In IEEE 754 floating-point numbers, the exponent is biased in the engineering sense of the word – the value stored is offset from the actual value by the exponent bias, also called a biased exponent.[1] Biasing is done because exponents have to be signed values in order to be able to represent both tiny and huge values, but two's complement, the usual representation for signed values, would make comparison harder.

To solve this problem the exponent is stored as an unsigned value which is suitable for comparison, and when being interpreted it is converted into an exponent within a signed range by subtracting the bias.

By arranging the fields such that the sign bit takes the most significant bit position, the biased exponent takes the middle position, then the significand will be the least significant bits and the resulting value will be ordered properly. This is the case whether or not it is interpreted as a floating-point or integer value. The purpose of this is to enable high speed comparisons between floating-point numbers using fixed-point hardware.

If there are [math]\displaystyle{ e }[/math] bits in the exponent, the bias is typically set as [math]\displaystyle{ b = 2^{e-1}-1 }[/math].[2]

Therefore, the possible integer values that the biased exponent can express lie in the range [math]\displaystyle{ [1-b, b] }[/math]. To understand this range, with [math]\displaystyle{ e }[/math] bits in the exponent, the possible unsigned integers lie in the range [math]\displaystyle{ [0, 2^{e}-1] }[/math]. However, the strings containing all zeros and all ones are reserved for special values, so the expressible integers lie in the range [math]\displaystyle{ [1, 2^{e}-2] }[/math]. It follows that:

  • The maximum biased value is [math]\displaystyle{ (2^{e}-2) - b = 2b - b = b }[/math].
  • The minimum biased value is [math]\displaystyle{ 1 - b }[/math].

When interpreting the floating-point number, the bias is subtracted to retrieve the actual exponent.

  • For a half-precision number, the exponent is stored in the range 1 .. 30 (0 and 31 have special meanings), and is interpreted by subtracting the bias for an 5-bit exponent (15) to get an exponent value in the range −14 .. +15.
  • For a single-precision number, the exponent is stored in the range 1 .. 254 (0 and 255 have special meanings), and is interpreted by subtracting the bias for an 8-bit exponent (127) to get an exponent value in the range −126 .. +127.
  • For a double-precision number, the exponent is stored in the range 1 .. 2046 (0 and 2047 have special meanings), and is interpreted by subtracting the bias for an 11-bit exponent (1023) to get an exponent value in the range −1022 .. +1023.
  • For a quad-precision number, the exponent is stored in the range 1 .. 32766 (0 and 32767 have special meanings), and is interpreted by subtracting the bias for a 15-bit exponent (16383) to get an exponent value in the range −16382 .. +16383.

History

The floating-point format of the IBM 704 introduced the use of a biased exponent in 1954.

See also

References

  1. Sumner, Frank H., ed (1980). "6.1 Floating-Point Notation / 6.8.5 Exponent Representation". Design of Arithmetic Units for Digital Computers. Macmillan Computer Science Series (1 ed.). Department of Computer Science, University of Manchester, Manchester, UK: The Macmillan Press Ltd. pp. 74, 91, 137. ISBN 0-333-26397-9. "[…] In floating-point representation, a number x is represented by two signed numbers m and e such that x = m · be where m is the mantissa, e the exponent and b the base. […] The mantissa is sometimes termed the characteristic and a version of the exponent also has this title from some authors. It is hoped that the terms here will be unambiguous. […] [w]e use a[n exponent] value which is shifted by half the binary range of the number. […] This special form is sometimes referred to as a biased exponent, since it is the conventional value plus a constant. Some authors have called it a characteristic, but this term should not be used, since CDC and others use this term for the mantissa. It is also referred to as an 'excess -' representation, where, for example, - is 64 for a 7-bit exponent (27−1 = 64). […]" 
  2. Computer systems: a programmer's perspective (2 ed.). Boston, Massachusetts, USA: Prentice Hall. 2010. ISBN 978-0-13-610804-7. 




Licensed under CC BY-SA 3.0 | Source: https://handwiki.org/wiki/Exponent_bias
14 views | Status: cached on July 17 2024 04:51:15
↧ Download this article as ZWI file
Encyclosphere.org EncycloReader is supported by the EncyclosphereKSF