Number systems and base conversion, signed integers (sign-magnitude, 1's and 2's complement), overflow in 2's complement arithmetic, and IEEE 754 floating-point encoding, range and special values.
Before you start
Powers of two
Every range, weight and exponent in this topic is a power of two; know to by heart.
Place value in decimal
Base conversion is the same place-value idea with weights instead of .
In base , the digit string has value . GATE uses binary (), octal (), hexadecimal (, digits 0–9, A–F) and decimal.
Base to decimal: multiply each digit by its weight and add. .
Decimal integer to base : divide repeatedly by ; the remainders, read bottom to top, are the digits.
Decimal fraction to base : multiply the fraction repeatedly by ; the integer parts, read top to bottom, are the digits. Some fractions (like ) never terminate in binary.
Binary to octal / hex: group bits in threes / fours outwards from the binary point, padding with zeros. .
An -bit unsigned number covers to . BCD stores each decimal digit in its own 4-bit group, so in BCD; the codes 1010 to 1111 are unused. To check a base question quickly, convert both sides to decimal.
2. Signed integers: three representations
With bits, the MSB carries the sign in all three schemes, but the negative patterns differ.
Scheme
How is formed
Range
Zeros
Sign-magnitude
set the MSB to 1
to
two
1's complement
invert every bit
to
two
2's complement
invert every bit, add 1
to
one
2's complement is what hardware uses: one zero, and the same adder works for signed and unsigned numbers. Its MSB has weight , so .
A quick way to negate in 2's complement: copy bits from the right up to and including the first 1, then invert the rest. The most negative number (1000…0) has no positive partner in bits; negating it gives itself.
Sign extension: to widen a 2's complement number, copy the sign bit into the new MSBs (, still ). In 1's complement the same rule holds; in sign-magnitude, insert zeros after the sign bit.
3. 2's complement addition and overflow
Add the bit patterns as unsigned numbers and discard the carry out of the MSB. Subtraction is .
Overflow happens when the true result is outside to . Two equivalent tests:
Both operands have the same sign and the result has the opposite sign. Adding numbers of opposite signs never overflows.
The carry into the MSB differs from the carry out of the MSB: .
Example in 8 bits: () gives , which reads as . Carry into the MSB is 1, carry out is 0, so .
Do not confuse the carry flag with overflow. The carry out of the MSB signals unsigned overflow; for signed numbers it is ignored. () produces a carry out but the result is correct.
In 1's complement, a carry out of the MSB is added back to the LSB (end-around carry).
4. IEEE 754 floating point
A floating-point number is stored as sign , biased exponent and fraction :
Format
bits
bits
Bias
Single (32-bit)
1
8
23
127
Double (64-bit)
1
11
52
1023
For a normalised number ( in single precision), value . The leading 1 is implied (the hidden bit), so 23 stored bits give 24 bits of precision.
Special exponent values (single precision):
, : .
, : denormal, value . These fill the gap near zero.
, : .
, : NaN.
Key values: smallest positive normal ; smallest positive denormal ; largest finite .
To encode: write the number in binary, normalise to , store and the bits after the point. To decode: split the hex into bits, read , , and apply the formula. The spacing between neighbouring floats grows with the exponent, so precision is relative, not absolute.
10 questions: up to 3 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 EC syllabus; being checked by a reviewer. Updated 2026-11-28. Spotted a mistake? Use Report an issue on any question, or contact us.