Offset binary
Offset binary,^{[1]} also referred to as excessK,^{[1]} excessN, excesse,^{[2]}^{[3]} excess code or biased representation, is a digital coding scheme where allzero corresponds to the minimal negative value and allone to the maximal positive value. There is no standard for offset binary, but most often the offset K for an nbit binary word is K = 2^{n−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 true form numerical comparison operation, whereas, in two's complement notation a logical comparison will agree with true form 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.
One historically prominent example of offset64 (excess64) 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 sevenbit excess64 number (The highorder bit of the same byte contained the sign of the significand).^{[4]}
The 8bit 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 offset129 notation (excess129).
The IEEE Standard for FloatingPoint 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 2^{n−1}" it uses "excess 2^{n−1} − 1" (i.e. excess15, excess127, excess1023, excess16383) which means that inverting the leading (highorder) 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.^{[5]}
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 nbit word being 2^{n−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^{[6]}
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 8bit 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.
Related codes
 [math]z = \left[\left(\sum_{i=1}^n p_i \times b_i\right)  k\right] / q[/math]^{[2]}^{[3]}^{[7]}
Code  Type  Offset k  Width n  Factor q  Weights  Distance  Checking  Complement  Groups of 5  Simple addition 

8421 code  n^{[8]}  0  4  1  8 4 2 1  1..4  No  No  No  No 
Nuding code^{[8]}^{[9]}  3n + 2^{[8]}  2  5  3  N/A  2..5  Yes  Yes (9)  Yes  Yes 
Stibitz code^{[10]}  n + 3^{[8]}  3  4  1  8 4 −2 −1  1..4  No  Yes (9)  Yes  Yes 
Diamond code^{[8]}^{[11]}  27n + 6^{[8]}^{[12]}^{[13]}  6  8  27  N/A  3..8  Yes  Yes (9)  Yes  Yes 
25n + 15^{[12]}^{[13]}  15  8  25  N/A  3+  Yes  Yes  ?  Yes  
23n + 24^{[12]}^{[13]}  24  8  23  N/A  3+  Yes  Yes  ?  Yes  
19n + 42^{[12]}^{[13]}  42  8  19  N/A  3..8  Yes  Yes (9)  Yes  Yes 






See also
 Signed number representations
 Binary number
 Excess3
 Excess128
 Exponent bias
 ExcessGray code
 Ones' complement
 Binary offset carrier
References
 ↑ ^{1.0} ^{1.1} "2.5.2: Data Representation: Offset binary representation (ExcessK)". COMPSCI 210S1T 2006. Department of Computer Science, The University of Auckland, NZ. 20060307. p. 18. http://www.cs.auckland.ac.nz/~patrice/2102006/210%20LN04_2.pdf. Retrieved 20160204.
 ↑ ^{2.0} ^{2.1} ^{2.2} Digital Electronics. Philips Technical Library (PTL) / Macmillan Education (Reprint of 1st English ed.). Eindhoven, Netherlands: The Macmillan Press Ltd. / N. V. Philips' Gloeilampenfabrieken. 19730618. p. 44. doi:10.1007/9781349014170. ISBN 9781349014194. https://books.google.com/books?id=hlRdDwAAQBAJ. Retrieved 20180701. (270 pages) (NB. This is based on a translation of volume I of the twovolume German edition.)
 ↑ ^{3.0} ^{3.1} ^{3.2} "2.4.4.4. ExzeßeKodes" (in de). Digitale Elektronik in der Meßtechnik und Datenverarbeitung: Theoretische Grundlagen und Schaltungstechnik. Philips Fachbücher. I (improved and extended 5th ed.). Hamburg, Germany: Deutsche Philips GmbH. 1975. pp. 51, 53–54. ISBN 3871452726. (xii+327+3 pages) (NB. The German edition of volume I was published in 1969, 1971, two editions in 1972, and 1975. Volume II was published in 1970, 1972, 1973, and 1975.)
 ↑ IBM System/360 Principles of Operation Form A226821. Various editions available on the WWW.^{[page needed]}
 ↑ ((Electrical and Computer Science Department, Southeastern Massachusetts University, North Dartmouth, MA, USA)) (1988). Chen, Chihau. ed. Signal Processing Handbook. New York, USA: Marcel Dekker, Inc./CRC Press. ISBN 0824779568. https://books.google.com/books?id=10Pi0MRbaOYC. Retrieved 20160204.
 ↑ "Data Conversion Binary Code Formats". Intersil Corporation. May 1997. http://www.intersil.com/data/an/an9657.pdf.
 ↑ ^{7.0} ^{7.1} "10.5.3.5 ExcesseCode" (in de). Elektronik: Digitale Schaltungen und Systeme. Studium Technik. 3 (revised 2nd ed.). Friedrich Vieweg & Sohn Verlagsgesellschaft mbH. January 1997. pp. 120–121. doi:10.1007/9783322850539. ISBN 9783528133665. https://books.google.com/books?id=VcmeBgAAQBAJ&pg=PA120&lpg=PA118. Retrieved 20200526. (xviii+393 pages)
 ↑ ^{8.0} ^{8.1} ^{8.2} ^{8.3} ^{8.4} ^{8.5} ^{8.6} ^{8.7} "Checking Codes for Digital Computers". Proceedings of the IRE. Correspondence (New York, USA) 43 (4): 483–490 [487–488]. April 1955. ISSN 00968390. https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=4055437. Retrieved 20200526. (2 pages) (NB. The results discussed in this report are based on an earlier study carried out by Joseph M. Diamond and Morris Plotkin at Moore School of Engineering, University of Pennsylvania, in 1950–1951, on contract with the Burroughs Adding Machine Co.)
 ↑ ^{9.0} ^{9.1} "Ein Sicherheitscode für Fernschreibgeräte, die zur Ein und Ausgabe an elektronischen Rechenmaschine verwendet werden" (in de). Zeitschrift für Angewandte Mathematik und Mechanik (ZAMM). Kleine Mitteilungen 39 (5–6): 429. 19590101. doi:10.1002/zamm.19590390511. https://onlinelibrary.wiley.com/doi/abs/10.1002/zamm.19590390511. (1 page)
 ↑ ^{10.0} ^{10.1} "Complex Computer". 19540209. https://patents.google.com/patent/US2668661?oq=US2668661. [1] (102 pages)
 ↑ "Binary Codes with Specified Minimum Distance". IRE Transactions on Information Theory IT6 (4): 445–450. September 1960. doi:10.1109/TIT.1960.1057584. ISSN 00961000. (NB. Also published as Research Division Report 5120 of University of Pennsylvania in January 1951.)
 ↑ ^{12.0} ^{12.1} ^{12.2} ^{12.3} ^{12.4} "Error Detecting and Correcting Binary Codes for Arithmetic Operations". IRE Transactions on Electronic Computers EC9 (3): 333–337. September 1960. doi:10.1109/TEC.1960.5219855. ISSN 03679950.
 ↑ ^{13.0} ^{13.1} ^{13.2} ^{13.3} ^{13.4} "15.3 Arithmetic Codes / 15.6 SelfComplementing AN + B Codes". written at Honolulu, Hawaii. ErrorCorrecting Codes (2 ed.). Cambridge, Massachusetts, USA: The Massachusetts Institute of Technology (The MIT Press). 1972. pp. 454–456, 460–461 [456, 461]. ISBN:9780262160391. ISBN 0262160390. (xii+560+4 pages)
Further reading
 "Decimal Representations". quadibloc. 2018. http://www.quadibloc.com/comp/cp0203.htm. (NB. Mentions Excess3, Excess6, Excess11, Excess123.)
 "ChenHo Encoding and Densely Packed Decimal". quadibloc. 2018. http://www.quadibloc.com/comp/cp020301.htm. (NB. Mentions Excess25, Excess250.)
 "FloatingPoint Formats". quadibloc. 2018. http://www.quadibloc.com/comp/cp0201.htm. (NB. Mentions Excess32, Excess64, Excess128, Excess256, Excess976, Excess1023, Excess1024, Excess2048, Excess16384.)
 "Computer Arithmetic". quadibloc. 2018. http://www.quadibloc.com/comp/cp02.htm. (NB. Mentions Excess64, Excess500, Excess512, Excess1024.)
Original source: https://en.wikipedia.org/wiki/ Offset binary.
Read more 