1 / 6

Two’s complement

By Jariya Phongsai. Two’s complement.

Download Presentation

Two’s complement

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. By Jariya Phongsai Two’s complement

  2. A two's-complement system is a system in which negative numbers are represented by the two's complement of the absolute value; this system is the most common method of representing signed integers on computer. In such a system, a number is negated (converted from positive to negative) by computing its two's complement. What is the two’s complement

  3. The two's-complement system has the advantage of not requiring that the addition and subtraction circuitry examine the signs of the operands to determine whether to add or subtract. This property makes the system both simpler to implement and capable of easily handling higher precision arithmetic. Also, zero has only a single representation, obviating the subtleties associated with negative zero, which exists in one’s complement systems.

  4. Example Suppose we're working with 8 bit and suppose we want to find how -28 would be expressed in two's complement notation. First we write out 28 in binary form. 0 0 0 1 1 1 0 0 Then we invert the digits. 0 becomes 1, 1 becomes 0. 1 1 1 0 0 0 1 1 Then we add 1. 1 1 1 0 0 1 0 0 That is how one would write -28 in 8 bit binary.

  5. The system is called two's complement because the negative of a number is formed by complementing each bit (subtracting it from 1, the "one's complement") and then adding 1 to the result: Because of the way the numbers are assigned, adding one in binary still adds one to the negative number; in fact, when you add one to -1, you get zero (ignoring the carry). To add any two signed numbers, you just add the binary values, and again ignore the carry, if any Why it is called two’s complement

More Related