Don't miss an insight. Subscribe to Techopedia for free.


Carry Flag

What Does Carry Flag Mean?

A carry flag in computer science works with the arithmetic
logic unit (ALU) of a computer’s central processing unit to handle arithmetic and
bitwise logical operations on binary numbers. The carry flag is used when an
operation changes the left-hand bit of the binary system. Some call this the
most significant or “leftmost” bit.


Techopedia Explains Carry Flag

The way the carry flag works is based on how addition and subtraction happens with binary numbers. Changes to the leftmost bit indicate a kind of turnover of a binary number set. For instance, when a binary sequence of 1111 gets 0001 added to it, and becomes 0000, the carry flag is turned on. Likewise, when 0000 gets 0001 subtracted, the result is 1111, and the carry flag gets turned on.

Problems with carry flags and other types of flags such as overflow flags can contribute to overflow errors and other bugs in code. The role of these flags and indicators is related to the different ways that arithmetic works in binary, compared to the addition and subtraction that is taught in school related to integers.


Related Terms