Page 42 - Programming With Python 3
P. 42

An Introduction to STEM Programming with Python — 2019-09-03a                               Page 29
            Chapter 2 — Numbering Systems


                                        Binary Decimal         Binary Decimal
             Free                                          -8      0000            0
                                           1000
                                                                                   1
                                           1001
                                                           -7
                                                                   0001
                                                                   0010
                                           1010
                                                                                   2
                                                           -6
                                            1011           -5      0011            3
                                            1100           -4      0100            4
                                            1101           -3      0101            5
                                            1110           -2      0110            6
             eBook  -1                                             0111            7
                                            1111
                                            Table 4: Twos' Compliment Numbers
             Edition



            Subtraction of Binary Numbers (Using Twos' Compliment)



            The easiest method for subtracting two binary numbers oi to convert one of them to the twos'
            Please support this work at
            compliment and add them.

            Example:
                                  http://syw2l.org
            Given a 4 bit processor subtract 3 from 7:


               0111 — decimal 7
               1101 — twos' compliment of 3
              10100 — add                                                      Free
               0100 — ignore the last carry bit — answer is decimal 4


                                                                   eBook
            Summary



            Summary goes here

                                                                Edition
            Important Terms



                •   addition                     •   binary                       •   bit



            Copyright 2019 — James M. Reneau Ph.D. — http://www.syw2l.org — This work is licensed
            under a Creative Commons Attribution-ShareAlike 4.0 International License.
   37   38   39   40   41   42   43   44   45   46   47