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

Margaret Rouse
Technology Expert

Margaret is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.