请输入您要查询的百科知识:

 

词条 Offset binary
释义

  1. See also

  2. References

  3. Further reading

Offset binary, also referred to as excess-K, excess-N, excess code or biased representation, is a digital coding scheme where all-zero corresponds to the minimal negative value and all-one to the maximal positive value. There is no standard for offset binary, but most often the offset K for an n-bit binary word is K = 2n−1. This has the consequence that the "zero" value is represented by a 1 in the most significant bit and zero in all other bits, and in general the effect is conveniently the same as using two's complement except that the most significant bit is inverted. It also has the consequence that in a logical comparison operation, one gets the same result as with a two's complement numerical comparison operation, whereas, in two's complement notation a logical comparison will agree with two's complement numerical comparison operation if and only if the numbers being compared have the same sign. Otherwise the sense of the comparison will be inverted, with all negative values being taken as being larger than all positive values.

{{anchor|Excess-64}}One historically prominent example of offset-64 (excess-64) notation was in the floating point (exponential) notation in the IBM System/360 and System/370 generations of computers. The "characteristic" (exponent) took the form of a seven-bit excess-64 number (The high-order bit of the same byte contained the sign of the significand).[3]{{anchor|Excess-129}}The 8-bit exponent in Microsoft Binary Format, a floating point format used in various programming languages (in particular BASIC) in the 1970s and 1980s, was encoded using an offset-129 notation (excess-129).{{anchor|Excess-15|Excess-127|Excess-1023|Excess-16383}}The IEEE Standard for Floating-Point Arithmetic (IEEE 754) uses various sizes of exponent, but also uses offset notation for the format of each precision. Unusually however, instead of using "excess 2n−1" it uses "excess 2n−1 − 1" (i.e. excess-15, excess-127, excess-1023, excess-16383) which means that inverting the leading (high-order) bit of the exponent will not convert the exponent to correct two's complement notation.

Offset binary is often used in digital signal processing (DSP). Most analog to digital (A/D) and digital to analog (D/A) chips are unipolar, which means that they cannot handle bipolar signals (signals with both positive and negative values). A simple solution to this is to bias the analog signals with a DC offset equal to half of the A/D and D/A converter's range. The resulting digital data then ends up being in offset binary format.[4]

Most standard computer CPU chips cannot handle the offset binary format directly. CPU chips typically can only handle signed and unsigned integers, and floating point value formats. Offset binary values can be handled in several ways by these CPU chips. The data may just be treated as unsigned integers, requiring the programmer to deal with the zero offset in software. The data may also be converted to signed integer format (which the CPU can handle natively) by simply subtracting the zero offset. As a consequence of the most common offset for an n-bit word being 2n−1, which implies that the first bit is inverted relative to two's complement, there is no need for a separate subtraction step, but one simply can invert the first bit. This sometimes is a useful simplification in hardware, and can be convenient in software as well.

Table of offset binary for four bits, with two's complement for comparison[5]

Offset binary code, K = 8 Decimal code Two's complement binary
1111 7 0111
1110 6 0110
1101 5 0101
1100 4 0100
1011 3 0011
1010 2 0010
1001 1 0001
1000 0 0000
0111 −1 1111
0110 −2 1110
0101 −3 1101
0100 −4 1100
0011 −5 1011
0010 −6 1010
0001 −7 1001
0000 −8 1000

Offset binary may be converted into two's complement by inverting the most significant bit. For example, with 8-bit values, the offset binary value may be XORed with 0x80 in order to convert to two's complement. In specialised hardware it may be simpler to accept the bit as it stands, but to apply its value in inverted significance.

See also

  • Signed number representations
  • Binary numeral system
  • Excess-3
  • Excess-128
  • Exponent bias
  • Excess-Gray code
  • Ones' complement

References

1. ^{{cite book |title=Signal Processing Handbook |editor-first=Chi-hau |editor-last=Chen |publisher=Marcel Dekker, Inc./CRC Press |author=((Electrical and Computer Science Department, Southeastern Massachusetts University, North Dartmouth, MA, USA)) |publication-place=New York, USA |date=1988 |isbn=0-8247-7956-8 |url=https://books.google.com/books?id=10Pi0MRbaOYC |access-date=2016-02-04}}
2. ^IBM System/360 Principles of Operation Form A22-6821. Various editions available on the WWW.
3. ^{{cite web |title=Data Conversion Binary Code Formats |publisher=Intersil Corporation |publication-date=2000 |date=May 1997 |id=AN9657.1 |url=http://www.intersil.com/data/an/an9657.pdf |access-date=2016-02-04}}
[1][2][3]
}}

Further reading

  • {{anchor|Excess-6|Excess-11|Excess-123}} {{cite web |title=Decimal Representations |author-first=John J. G. |author-last=Savard |date=2018 |orig-year=2006 |work=quadibloc |url=http://www.quadibloc.com/comp/cp0203.htm |access-date=2018-07-16 |dead-url=no |archive-url=https://web.archive.org/web/20180716101321/http://www.quadibloc.com/comp/cp0203.htm |archive-date=2018-07-16}} (NB. Mentions Excess-3, Excess-6, Excess-11, Excess-123.)
  • {{anchor|Excess-25|Excess-250}} {{cite web |title=Chen-Ho Encoding and Densely Packed Decimal |author-first=John J. G. |author-last=Savard |date=2018 |orig-year=2007 |work=quadibloc |url=http://www.quadibloc.com/comp/cp020301.htm |access-date=2018-07-16 |dead-url=no |archive-url=https://web.archive.org/web/20180703002320/http://www.quadibloc.com/comp/cp020301.htm |archive-date=2018-07-16}} (NB. Mentions Excess-25, Excess-250.)
  • {{anchor|Excess-32|Excess-256|Excess-976|Excess-2048|Excess-16384}} {{cite web |title=Floating-Point Formats |author-first=John J. G. |author-last=Savard |date=2018 |orig-year=2005 |work=quadibloc |url=http://www.quadibloc.com/comp/cp0201.htm |access-date=2018-07-16 |dead-url=no |archive-url=https://web.archive.org/web/20180703001709/http://www.quadibloc.com/comp/cp0201.htm |archive-date=2018-07-16}} (NB. Mentions Excess-32, Excess-64, Excess-128, Excess-256, Excess-976, Excess-1023, Excess-1024, Excess-2048, Excess-16384.)
  • {{anchor|Excess-500|Excess-512|Excess-1024}} {{cite web |title=Computer Arithmetic |author-first=John J. G. |author-last=Savard |date=2018 |orig-year=2005 |work=quadibloc |url=http://www.quadibloc.com/comp/cp02.htm |access-date=2018-07-16 |dead-url=no |archive-url=https://web.archive.org/web/20180716102439/http://www.quadibloc.com/comp/cp02.htm |archive-date=2018-07-16}} (NB. Mentions Excess-64, Excess-500, Excess-512, Excess-1024.)

2 : Numeral systems|Binary arithmetic

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/13 15:13:54