Number representation and arithmetic (fixed and floating point)
Number systems and base conversion, signed integers (sign-magnitude, 1's and 2's complement) with ranges and overflow, fixed-point fractions, and IEEE 754 floating point: encoding, decoding, special values and arithmetic.
Before you start
Positional notation and powers of 2
Every conversion and range formula is a sum of digit times base power.
Decimal integer to base : divide repeatedly by ; the remainders read bottom-up are the digits.
Decimal fraction to base : multiply the fraction by repeatedly; the integer parts read top-down are the digits. Some fractions never end: in binary is (repeating).
Binary to octal / hex: group bits in 3s / 4s from the binary point outwards. .
Unknown base questions: write both sides as polynomials in and solve, then check that every digit is less than . For example gives , so and .
With bits an unsigned integer ranges over to .
2. Signed integers: three representations
For bits, the most significant bit (MSB) acts as the sign in all three.
Representation
Negate by
Range
Zeros
Sign-magnitude
flipping the MSB
to
two (, )
1's complement
flipping all bits
to
two
2's complement
flipping all bits, then adding 1
to
one
For 8 bits, 2's complement covers to ; the other two cover to .
Value of a 2's complement pattern: the MSB has weight , the rest are normal. . Equivalently, a pattern with MSB 1 means (unsigned value) : in 16 bits is .
Sign extension: to widen a 2's complement number, copy the sign bit into the new high bits. (4-bit, ) becomes (8-bit, still ).
The most negative number has no positive partner: negating it gives itself (an overflow).
3. 2's complement arithmetic and overflow
Addition is plain binary addition; the carry out of the MSB is discarded. Subtraction is , so one adder handles both.
Overflow means the true result is outside the range. It can happen only when both operands have the same sign, and is detected in either of two equivalent ways:
The two operands have the same sign but the result has the other sign.
The carry into the MSB differs from the carry out of the MSB: .
A carry out of the MSB on its own is not overflow in signed arithmetic. For example, in 8 bits : . Drop the carry: , correct. Both carries are 1, so no overflow.
In 1's complement addition, a carry out of the MSB is added back to the result (end-around carry).
For unsigned numbers, by contrast, overflow is exactly the carry out of the MSB.
4. Fixed-point numbers
A fixed-point format puts the binary point at a fixed position. With integer bits and fraction bits (often written ), the stored integer means .
Resolution (gap between neighbours) , the same everywhere.
Unsigned range: to .
Signed (2's complement over all bits): to .
Example: 8-bit signed, 4 fraction bits, pattern . As an integer ; divide by : .
Fixed-point arithmetic is integer arithmetic plus a scale. Adding two numbers with the same keeps . Multiplying gives fraction bits, which must be shifted back.
Fixed point
Floating point
Gap between values
constant
grows with the magnitude
Range for bits
small
very large
Hardware
simple, fast
needs alignment and normalisation
5. IEEE 754 floating point
A normalised binary float is . The leading 1 is not stored (hidden bit).
Format
Sign
Exponent
Fraction
Bias
Single (32-bit)
1
8
23
127
Double (64-bit)
1
11
52
1023
Special exponent fields (single):
, : . , : denormal (no hidden 1; fills the gap near zero).
, : . , : NaN.
So normal exponents run , actual exponents .
Key values (single): smallest positive normal ; smallest positive denormal ; largest finite . The gap between consecutive floats in is ; in it is .
Encoding a decimal: convert to binary, normalise to , store and the bits after the point.
Addition: align the smaller exponent to the larger by shifting its significand right, add, renormalise, round. Bits shifted out are lost, so float addition is not associative and is not exact.
IEEE 754 single precision layout and how each exponent field is read.
Formulas to remember
Unsigned range (n bits)
2's complement range (n bits)
Sign-magnitude / 1's complement range
2's complement negation
Overflow flagCarry into the MSB XOR carry out of the MSB
10 questions: up to 4 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.
Mark as mastered
Loading your progress…
My revision notes
Notes written by the GATEiit team against the official GATE CSE syllabus; being checked by a reviewer. Updated 2026-11-21. Spotted a mistake? Use Report an issue on any question, or contact us.