Study resource
Binary number system revision notes
Study Binary number system with curriculum-aligned Revision Notes resources, practice links, and exam-focused support.
At a glance
revision notes
Resource type
Topic
Binary number system
Revision notes
Binary Number System: Integers, Fractions and Floating Point
Unsigned binary
Unsigned binary represents only non-negative integers. Each bit position has a power-of-two value, such as 8, 4, 2 and 1 in a four-bit number. Convert binary to decimal by adding the place values of the bits set to 1. Convert decimal to binary by selecting powers of two whose total equals the decimal value.
For
nbits, the minimum unsigned value is0and the maximum is2^n - 1. For example, four bits have a range of0to15.Unsigned arithmetic
Add binary integers from right to left, carrying when a column totals two or more. Multiplication can use the same shift-and-add idea as decimal multiplication: shift a partial product according to the position of each 1 bit in the multiplier, then add the partial products. Check that the result fits the available number of bits; otherwise overflow occurs.
Two's complement
Two's complement is the signed-binary representation examined for negative integers. The most significant bit contributes a negative place value. For an
n-bit value, its place value is-2^(n-1), while the remaining bits have positive powers-of-two values. This gives ann-bit range of-2^(n-1)to2^(n-1)-1.To represent a negative integer, write the positive magnitude in binary, invert every bit and add 1. To decode a value whose most significant bit is 1, either use the negative place value directly or invert the bits, add 1 and attach a negative sign. Subtraction can be performed by adding the two's complement representation of the number being subtracted.
Binary fractions
In fixed point, the binary point has a fixed position. Bits to the right represent
2^-1,2^-2,2^-3and so on. For example,0.101in binary represents1/2 + 0/4 + 1/8 = 0.625in decimal. The available bits are divided between the whole-number and fractional parts, so changing the point is not free: more fractional bits can improve fractional precision but leave fewer bits for the integer range.In simplified floating point, a number is stored as a mantissa plus an exponent. The mantissa contains the significant binary digits and the exponent specifies how the binary point is shifted. In the examination format, both mantissa and exponent use two's complement. Convert by applying the exponent's shift to the mantissa, and encode or decode each field using its specified number of bits.
Errors and limits
A binary fraction is exact only when it can be represented in the available bits. Some decimal fractions cannot be represented exactly in binary, so storing them can cause rounding error. Fixed point and floating point values may therefore be inaccurate.
Absolute error is the magnitude of the difference between the stored or calculated value and the intended value. Relative error compares this difference with the intended value, commonly expressed as
absolute error / intended value. Absolute error is measured in the same units as the data, whereas relative error allows errors to be compared for values of different magnitudes. Always use the values specified by the question and state the formula used.Fixed point has a fixed range determined by the number of integer bits and a consistent fractional precision. It can be fast to calculate because the point position is fixed, but its range may be limited. Floating point provides a wider range because the exponent moves the point, but it has limited precision in the mantissa and calculations can be more complex or slower.
Normalisation, underflow and overflow
Floating point numbers are normalised so that the available mantissa bits represent the significant information without unnecessary leading repetition. Normalise by shifting the binary point and changing the exponent by the corresponding amount, while preserving the value. The procedure must work for positive and negative mantissas and must keep both fields within their available ranges.
Overflow occurs when a value is too large to be represented in the available format. Underflow occurs when a non-zero value is too small in magnitude to be represented in that format. Both can produce an inaccurate result or prevent representation.
Common errors
- Using the unsigned range for a two's complement value.
- Forgetting that the most significant two's complement bit has a negative place value.
- Treating the exponent as unsigned when the stated floating-point format uses two's complement.
- Moving a binary point without changing the exponent.
- Assuming every decimal fraction has an exact binary representation.
- Confusing absolute error with relative error.
- Claiming that floating point always gives greater precision: it generally offers greater range, while precision depends on the mantissa.
Related topics
