page_title: Addition
section_title: Computers
hierarchical_section_title: Addition / Performing addition / Computers
caption_attribution_description: Deutsch: Teil einer Differenzmaschine von Charles Babbage. Posthum aus Einzelteileilen aus dem Laboratorium zusammengesetzt durch seinen Sohn Henry Provost Babbage. Die Messingteile wurden vom Werkzeugmacher Joseph Clement hergestellt. Henry Provost Babbage erbte die Einzelteile nach dem Tod seines Vaters 1871. 1879 baute er einige funktionfähige Abschnitte der Maschine zusammen. Höchstwahrscheinlich existieren sieben solche zusammengebauten Abschnitte. Der abgebildete Abschnitt befindet sich im Whipple Museum of the History of Science der University of Cambridge und stellt dar, wie der Additions- und Übertragsmechanismus funktioniert. Die linke untere Seite des Fotos ist durch Reflexionen in der Glasscheibe der Ausstellungsvitrine nur schwer erkennbar. English: Part of Charles Babbage's Difference Engine assembled after his death by Babbage's son, using parts found in his laboratory. The brass parts were machined by the toolmaker Joseph Clement. Babbage never completed his difference engine, partly due to problems with friction and machining accuracy, but also because he kept changing the design. Henry Provost Babbage inherited the pieces following his father's death in 1871, and some years later in 1879 he assembled several working sections of the full machine. Possibly as many as seven assembled sections exist. This portion, in the Whipple Museum of the History of Science of the University of Cambridge, demonstrates how the addition and carry mechanism works. In the photograph, part of the left hand side is obscured by reflections from the glass display case. Русский: Часть разностной машины Чарльза Бэббиджа включала в себя сложение и механизм переноса.
context_page_description: Addition is one of the four basic operations of arithmetic, the other three being subtraction, multiplication and division. The addition of two whole numbers results in the total amount or sum of those values combined. The example in the adjacent picture shows a combination of three apples and two apples, making a total of five apples. This observation is equivalent to the mathematical expression "3 + 2 = 5".
  Besides counting items, addition can also be defined and executed without referring to concrete objects, using abstractions called numbers instead, such as integers, real numbers and complex numbers. Addition belongs to arithmetic, a branch of mathematics. In algebra, another area of mathematics, addition can also be performed on abstract objects such as vectors, matrices, subspaces and subgroups.
  Addition has several important properties. It is commutative, meaning that order does not matter, and it is associative, meaning that when one adds more than two numbers, the order in which addition is performed does not matter. Repeated addition of 1 is the same as counting; addition of 0 does not change a number.
context_section_description: Analog computers work directly with physical quantities, so their addition mechanisms depend on the form of the addends. A mechanical adder might represent two addends as the positions of sliding blocks, in which case they can be added with an averaging lever. If the addends are the rotation speeds of two shafts, they can be added with a differential. A hydraulic adder can add the pressures in two chambers by exploiting Newton's second law to balance forces on an assembly of pistons. The most common situation for a general-purpose analog computer is to add two voltages (referenced to ground); this can be accomplished roughly with a resistor network, but a better design exploits an operational amplifier.
  Addition is also fundamental to the operation of digital computers, where the efficiency of addition, in particular the carry mechanism, is an important limitation to overall performance.
  The abacus, also called a counting frame, is a calculating tool that was in use centuries before the adoption of the written modern numeral system and is still widely used by merchants, traders and clerks in Asia, Africa, and elsewhere; it dates back to at least 2700–2300 BC, when it was used in Sumer.
  Blaise Pascal invented the mechanical calculator in 1642; it was the first operational adding machine. It made use of a gravity-assisted carry mechanism. It was the only operational mechanical calculator in the 17th century and the earliest automatic, digital computer. Pascal's calculator was limited by its carry mechanism, which forced its wheels to only turn one way so it could add. To subtract, the operator had to use the Pascal's calculator's complement, which required as many steps as an addition. Giovanni Poleni followed Pascal, building the second functional mechanical calculator in 1709, a calculating clock made of wood that, once setup, could multiply two numbers automatically.
  Adders execute integer addition in electronic digital computers, usually using binary arithmetic. The simplest architecture is the ripple carry adder, which follows the standard multi-digit algorithm. One slight improvement is the carry skip design, again following human intuition; one does not perform all the carries in computing 999 + 1, but one bypasses the group of 9s and skips to the answer.
  In practice, computational addition may be achieved via XOR and AND bitwise logical operations in conjunction with bitshift operations as shown in the pseudocode below. Both XOR and AND gates are straightforward to realize in digital logic allowing the realization of full adder circuits which in turn may be combined into more complex logical operations. In modern digital computers, integer addition is typically the fastest arithmetic instruction, yet it has the largest impact on performance, since it underlies all floating-point operations as well as such basic tasks as address generation during memory access and fetching instructions during branching. To increase speed, modern designs calculate digits in parallel; these schemes go by such names as carry select, carry lookahead, and the Ling pseudocarry. Many implementations are, in fact, hybrids of these last three designs. Unlike addition on paper, addition on a computer often changes the addends. On the ancient abacus and adding board, both addends are destroyed, leaving only the sum. The influence of the abacus on mathematical thinking was strong enough that early Latin texts often claimed that in the process of adding "a number to a number", both numbers vanish. In modern times, the ADD instruction of a microprocessor often replaces the augend with the sum but preserves the addend. In a high-level programming language, evaluating a + b does not change either a or b; if the goal is to replace a with the sum this must be explicitly requested, typically with the statement a = a + b. Some languages such as C or C++ allow this to be abbreviated as a += b.
  // Iterative Algorithmint add(int x, int y){
      int carry = 0;
      while (y != 0){      
         carry = AND(x, y);   // Logical AND
         x     = XOR(x, y);   /
caption: Part of Charles Babbage's Difference Engine including the addition and carry mechanisms
exif: {"Image Orientation": "Horizontal (normal)", "Image XResolution": "72", "Image YResolution": "72", "Image ResolutionUnit": "Pixels/Inch", "Image Software": "Adobe Photoshop CS2 Windows", "Image DateTime": "2012:05:06 22:39:18", "Image ExifOffset": "164", "Thumbnail Compression": "JPEG (old-style)", "Thumbnail XResolution": "72", "Thumbnail YResolution": "72", "Thumbnail ResolutionUnit": "Pixels/Inch", "Thumbnail JPEGInterchangeFormat": "302", "Thumbnail JPEGInterchangeFormatLength": "6054", "EXIF ColorSpace": "Uncalibrated", "EXIF ExifImageWidth": "800", "EXIF ExifImageLength": "589"}