Skip to content
BetterDL

Borrow

Also called: borrowing, borrow bit

In subtraction, taking 1 from the next column to the left when a column needs 0 − 1. In binary that 1 is worth 2 in the column that receives it.

A borrow is subtraction's version of a carry. When a column needs to take away more than it has, it takes 1 from the column to its left. In decimal that 1 is worth ten in the receiving column; in binary it's worth two.

In binary, the only column that needs a borrow is 0 − 1. Borrowing turns the 0 into 10₂ = 2, and 2 − 1 = 1. The lending column drops by 1.

If the lending column is 0, it has nothing to give, so it borrows from its own left neighbor first. A borrow can travel through a run of zeros, turning each one into a 1 on the way.

In hardware, adders subtract by adding the twos complement instead, and the borrow shows up in the carry out. When computing A − B as A + (inverted B) + 1:

  • carry-out 1 means no borrow: A ≥ B as unsigned numbers
  • carry-out 0 means a borrow: A < B, and the unsigned result has wrapped around

So after a subtraction, the carry flag is the opposite of a borrow flag in this convention (ARM works this way; x86 stores the borrow itself).

Worked examples

Example

A borrow through zeros: 10000₂ − 00001₂

16 − 1. Bit 0 needs 0 − 1, and bits 1 to 3 are all 0.

  1. 1.

    The borrow comes from bit 4, which drops to 0.

  2. 2.

    On the way down, bits 3, 2 and 1 each become 1, and bit 0 becomes 10₂.

  3. 3.

    Bit 0: 10₂ − 1 = 1.

  4. 4.

    Result: 01111 = 15 = 16 − 1.

Example

Spotting a borrow on an adder: 0010 − 0111

Unsigned 2 − 7.

  1. 1.

    Invert B: 0111 → 1000.

  2. 2.

    Add with carry-in 1: 0010 + 1000 + 1 = 1011, with no carry-out.

  3. 3.

    Carry-out 0 means a borrow: 2 < 7, so the unsigned result is wrong.

  4. 4.

    Read as two's complement, 1011 = −5, which is the correct signed answer.

Common mistakes

  • Forgetting that the lending column goes down by 1.

  • Reading carry-out 1 after A + B' + 1 as a borrow. In this method it means no borrow.

  • Borrowing from a 0 column without passing the borrow further left.

Practice Borrow

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Borrow is taught in Number Systems and Adders and ALUs.