SlideShare a Scribd company logo
1 of 47
Download to read offline
Number Systems &
   Operations


       Part I

                19 พฤศจิกายน 2555
Decimal Numbers (Base 10)
 People use decimal numbers.
 I hope you know this very well. However, let’s review:
    Ten digits  0-9
    The value of a digit is determined by its position in the
     number.


 	 	    . . . 102101100.10-110-210-3 . . .
Binary Numbers
                          Decimal   Binary
                                0             0
                                1             1
                                2            10
                                3            11
There are only 2 digits
                                4        100
(0 and 1) and we can            5        101
do binary counting as           6        110
shown in the table.             7        111
                                8      1000

                                9      1001
                               10      1010
Binary Numbers (Base 2)

  The weighting structure of binary numbers

	 	    2Positive power 23two 21 20
        n-1 . . . of 22               .2Negative . . . two
                                           2 power of 2
                                            -1      -2                     -n

           (whole number)                    (fractional number)
  25     24   23   22       21   20   2-1    2-2     2-3     2-4      2-5        2-6

  32     16   8     4       2    1    1/2   1/4      1/8     1/16 1/32 1/64
                                      0.5    0.25    0.125   0.0625   0.03125   0.015625
Binary-to-Decimal
Conversion
    Add the weights of all 1s in a binary number to get the
    decimal value.
	 	     ex: convert 11011012 to decimal


      Weight       26       25    24      23    22   21       20
	
       bin         1        1      0      1     1    0        1

	   11011012 ! = 26 + 25 + 23 + 22 + 20

        ! !    !        = 64 + 32 + 8 + 4 + 1
        ! !    !        = 109
Binary-to-Decimal
Conversion
    Fractional binary example
	   ex: convert 0.1011 to decimal

               Weight     2-1       2-2   2-3   24

                   bin    1         0     1     1

       	   0.1011 != 2-1 + 2-3 + 2-4

           ! ! ! = 0.5 + 0.125 + 0.0625
           !   !    ! = 0.6875
Decimal-to-Binary
Conversion
 Sum-of-weights method
    To get the binary number for a given decimal number,
     find the binary weights that add up to the decimal
     number.
 ex: convert 1210 , 2510 , 5810 , 8210 to binary

 ! 12 = 8+4 = 23+22 = 1100
 ! 25 = 16+8+1 = 24+23+20 = 11001
 ! 58 = 32+16+8+2 = 25+24+23+21 = 111010
 ! 82 = 64+16+2 = 26+24+21 = 1010010
Decimal-to-Binary
Conversion
 Repeated division-by-2                            remainder
 method
                                   12/2 =      6       0   LSB
    To get the binary
     number for a given             6/2    =   3       0
     decimal number, divide
     the decimal number by          3/2    =   1       1
     2 until the quotient is 0.
                                    1/2    =   0       1   MSB
     Remainders form the
     binary number.
            Stop when the whole-number
                   quotient is 0
                                          1210 = 11002
Decimal-to-Binary
Conversion
 Converting decimal fractions to binary
    Sum-of-weights
        This method can be applied to fractional decimal
        numbers, as shown in the following example:
      ! 0.625 = 0.5+0.125 = 2-1+2-3 = 0.101
    Repeated multiplication by 2
        Decimal fraction can be converted to binary by
        repeated multiplication by 2 (see details in the
        following slide.)
Repeated Multiplication by 2
(by example)
 ex: convert the decimal fraction 0.3125 to binary

                                                    carry

                0.3125 x 2 =           0.625          0     MSB


                 0.625 x 2 =            1.25          1

                   0.25 x 2 =           0.50          0

                   0.50 x 2 =           1.00          1     LSB


 Continue to the desired number of decimal
 places or stop when the fractional part is all
                    zero                          0.312510 = 0.01012
Binary Arithmetic

 Basic of binary arithmetic
    Binary addition
    Binary subtraction
    Binary multiplication
    Binary division
Binary Addition

 The four basic rules for adding digits are as follows:
    0+0=0  sum of 0 with a carry of 0
    0+1=1  sum of 1 with a carry of 0
    1+0=1  sum of 1 with a carry of 0
    1+1=10  sum of 0 with a carry of 1
Binary Addition (by example)
      11    3      100    4
     +11   +3     + 10   +2
     110    6      110    6

    111     7      110    6
   + 11    +3     +100   +4
   1010    10     1010   10
Binary Subtraction

 The four basic rules for subtracting digits are as follows:
    0-0   = 0
    1-1   = 0
    1-0   = 1
    10-1 = 1 ; 0-1 with a borrow of 1
Binary Subtraction (by
example)
      11    3            11    3
     -01   -1           -10   -2
      10    2            01    1


             101    5
            -011   -3
             010    2
Binary Multiplication
 The four basic rules for multiplying digits are as
 follows:
    0x0 = 0
    0x1 = 0
    1x0 = 0
    1x1 = 1
 Multiplication is performed with binary numbers in
 the same manner as with decimal numbers.
    It involves forming partial products, shifting each
     successive partial product left one place, and then
     adding all the partial products.
Binary Multiplication (by example)

      11    3              101    5
     x11   x3            x111    x7
      11    9              101   35
    +11                   101
    1001                +101
                       100011
Binary Division
 Division in binary follows the same procedure as division
 in decimal.


     10           2              11              3
 11 110         3 6          10 110            2 6
    11            6             10               6
    000           0              10              0
                                 10
                                 00
1’s and 2’s Complements


 They are important since they permit the presentation of
 negative numbers.
 The method of 2’s complement arithmetic is commonly
 used in computers to handle negative numbers.
Finding the 1’s complement
 Very simple: change each bit in a number to get
 the 1’s complement

 ex: find 1’s complement of 111001012

      Binary       1 1 1 0 0 1 0 1

  1’s complement   0 0 0 1 1 0 1 0
Finding the 2’s Complement
 Add 1 to the 1’s complement to get the 2’s complement.
                                        +1
 ex: 10110010  01001101  01001110
                       1’s complement        2’s complement
 An alternative method:
    Start at the right with the LSB and write the bits as
     they are up to and including the first 1.
    Take the 1’s complement of the remaining bits.

 	 	    	   10110010!! 10111000!binary
 ! ! ! 01001110!! 01001000!2’s                   comp
Signed Numbers

 Digital systems, such as computer, must be able to
 handle both positive and negative numbers.
 A signed binary number consists of both sign and
 magnitude information.
    The sign indicates whether a number is positive or
     negative.
    The magnitude is the value of the number.
Signed Numbers
 There are 3 forms in which signed integer numbers can
 be represented in binary:
    Sign-magnitude (least used)
    1’s complement
    2’s complement (most important)
 Non-integer and very large or small numbers can be
 expressed in floating-point format.
The Sign Bit
 The left-most bit in a signed binary number is the sign bit.
    It tells you whether the number is positive (sign bit = 0) or
     negative (sign bit = 1).
Sign-Magnitude Form
 The left-most bit is the sign bit and the remaining bits are
 the magnitude bits.
    The magnitude bits are in true binary for both positive
     and negative numbers.
 ex: the decimal number +25 is expressed as an 8-bit
   signed binary number as:
 	 	     	   	   00011001
 While the decimal number -25 is expressed as
 	   	   	   	




 	 	     	   	   10011001
Sign-Magnitude Form


 “ In the sign-magnitude form, a negative
 number has the same magnitude bits as the
   corresponding positive number but the
     sign bit is a 1 rather than a 0. “
1’s Complement Form
 Positive numbers in 1’s complement form are represented
 the same way as the positive sign-magnitude.
 Negative numbers are the 1’s complements of the
 corresponding positive numbers.
 ex: the decimal number +25 is expressed as:

 	 	     	   	   00011001
 While the decimal number -25 is expressed as
 	   	   	   	




 	 	     	   	   11100110
1’s Complement Form



 “ In the 1’s complement form, a negative
    number is the 1’s complement of the
      corresponding positive number. “
2’s Complement Form
Positive numbers in 2’s complement form are represented the
same way as the positive sign-magnitude and 1’s complement
form.
Negative numbers are the 2’s complements of the
corresponding positive numbers.
ex: the decimal number +25 is expressed as:


	 	     	   	   00011001
While the decimal number -25 is expressed as
	   	   	   	




	 	     	   	   11100111
2’s Complement Form



 “ In the 2’s complement form, a negative
    number is the 2’s complement of the
      corresponding positive number. “
Decimal Value of Signed Numbers


 Sign-magnitude:
     Both positive and negative numbers are determined by
      summing the weights in all the magnitude bit
      positions where these are 1s and ignoring those
      positions where there are 0s.
     The sign is determined by examination of the sign bit.
Decimal Value of Signed Numbers
    Sign-magnitude (by example)
	   ex: decimal values of these numbers (expressed in sign-magnitude)
	   	     1) 10010101	 	       2) 01110111
	   1) 10010101	                       2) 01110111	
                                                  	
	   magnitude                        magnitude
	   26 25 24 23 22 21 20              26 25 24 23 22 21 20
!   0    0   1   0   1   0 1          1   1   1   0   1   1 1
!       = 16+4+1 = 21                     = 64+32+16+4+2+1 = 119
! sign                               sign
!       = 1  negative                 = 0  positive
! Hence: 10010101 = -21              Hence: 01110111 = 119
Decimal Value of Signed Numbers


 1’s complement:
     Positive – determined by summing the weights in all
      bit positions where there are 1s and ignoring those
      positions where there are 0s.
     Negative – determined by assigning a negative value
      to the weight of the sign bit, summing all the weights
      where there are 1’s, and adding 1 to the result.
Decimal Value of Signed Numbers
    1’s complement (by example)

   ex: decimal values of these numbers (expressed in 1’s complement)

	   	       1) 00010111	 	      2) 11101000

	   1) 00010111 	                       2) 11101000 	          	       	

	   -27 26 25 24 23 22 21 20                  -27 26 25 24 23 22 21 20
!       0   0   0   1   0   1   1 1            1   1   1   0       1       0   0 0
!


!       = 16+4+2+1 = +23                       = (-128)+64+32+8 = -24

!                                                                                    +1
! Hence: 00010111 = +23                   Hence: 11101000 = -23
Decimal Value of Signed Numbers


 2’s complement:
     Positive – determined by summing the weights in all
      bit positions where there are 1s and ignoring those
      positions where there are 0s.
     Negative – the weight of the sign bit in a negative
      number is given a negative value.
Decimal Value of Signed Numbers

    2’s complement (by example)

   ex: decimal values of these numbers (expressed in 2’s complement)

	   	       1) 01010110	 	      2) 10101010

	   1) 01010110	                               2) 10101010 	 	

	   -27 26 25 24 23 22 21 20                  -27 26 25 24 23 22 21 20
!       0   1   0   1   0   1   1 0            1   0   1   0   1   0   1 0
!       = 64+16+4+2 = +86                      = (-128)+32+8+2 = -86

! Hence: 01010110 = +86                   Hence: 10101010 = -86
Range of Signed Integer Numbers

 The range of magnitude of a binary number depends on
 the number of bits (n).
 Total combinations = 2n
     8 bits = 256 different numbers
     16 bits = 65,536 different numbers
     32 bits = 4,294,967,296 different numbers
Range of Signed Integer Numbers
 For 2’s complement signed numbers:
      Range = -(2n-1) to +(2n-1-1)
      where there is one sign bit and n-1 magnitude
 ex:
                         Negative         Positive
                         Boundary         Boundary
          4 bits        -(23) = -8      (23-1) = +7

          8 bits       -(27) = -128    (27-1) = +127

          16 bits    -(215) = -32,768 (215-1) = +32767
Floating-point numbers
 How many bits do we need to represent very
 large number?
 Floating-point number consists of two parts plus
 a sign.
    Mantissa – represents the magnitude of the number.
    Exponent – represents the number of places that the
     decimal point (or binary point) is to be moved.
    Decimal number example: 241,506,800
       Mantissa = 0.2415068
       Exponent = 109
       Can be written as FP as 0.2415068 x 109
Binary FP Numbers
 The format defined by ANSI/IEEE Standard
 754-1985
    Single-precision
    Double-precision
    Extended-precision

 Same basic formats except for the number of
 bits.
    Single-precision = 32 bits
    Double-precision = 64 bits
    (Double) Extended-precision = 80 bits
Single-Precision Floating-Point
Binary Numbers
 Standard format:
     Sign bit (S) – 1 bit
     Exponent (E) – 8 bits
     Mantissa or fraction (F) – 23 bits

            S(1)     E(8)              F(23)
            Single-precision FP Binary Number Format
Single-Precision Floating-Point
Binary Numbers
 Mantissa
     The binary point is understood to be to the left of the
      23 bits.
     Effectively, there are 24 bits in the mantissa because in
      any binary number the left most bit is always 1. (say
      001101100 is 1101100.)
     Therefore, this 1 is understood to be there although it
      does not occupy an actual bit position.
                       S(1)    E(8)               F(23)
                       Single-precision FP Binary Number Format
Single-Precision Floating-Point
Binary Numbers
 Exponent
     The eight bits represent a biased exponent which is
      obtained by adding 127.
     The purpose of the bias is to allow very large or very
      small numbers without requiring a separate sign bit for
      the exponents.
     The biased exp allows a range of actual exp values
      from -126 (000000012) to +128 (111111102)
                      S(1)    E(8)               F(23)
                      Single-precision FP Binary Number Format
Single-Precision Floating-Point
Binary Numbers
    Not easy, is it? Let’s see an example.
	 ex: 10110100100012           (assumption: positive number)

	 It can be expressed as 1 plus a fractional binary number.
	   	   Hence:

	   	      1011010010001 = 1.011010010001 x 212

	   The exponent,12, is expressed as a biased exponent as followed:

	   	      12+127 = 139 = 10001011

	   Therefore, we get:
                         0 10001011 01101001000100000000000
Single-Precision Floating-Point
Binary Numbers
 Let’s do the opposite way:
     To evaluate a binary number in FP format.
     General formula:
        ! Number = (-1)S(1+F)(2E-127)
  ex:     1 10010001 10001110001000000000000



  Number = (-1)(1.10001110001)(2145-127)
  ! ! ! = (-1)(1.10001110001)(218)
  ! ! ! = -11000111000100000002
Single-Precision Floating-Point
Binary Numbers
 Let’s review:
     The exponent can be any number between -126 to
      +128; that means extremely large and small numbers
      can be expressed.
     Say, a 32-bit FP number can replace a binary integer
      number having 129 bits.
     Distinctive point: Because the exponent
      determines the position of the binary point, numbers
      containing both integer and fractional parts can be
      represented.
Single-Precision Floating-Point
Binary Numbers

 There are 2 exceptions to the format for FP numbers:
     The number 0.0 is represented by all 0s.
          x 00000000 00000000000000000000000




     Infinity is represented by all 1s in the exponent and all
      0s in the mantissa.
          x 11111111 00000000000000000000000

More Related Content

What's hot

Chapter 1 digital systems and binary numbers
Chapter 1 digital systems and binary numbersChapter 1 digital systems and binary numbers
Chapter 1 digital systems and binary numbersMohammad Bashartullah
 
BINARY NUMBER SYSTEM
BINARY NUMBER SYSTEMBINARY NUMBER SYSTEM
BINARY NUMBER SYSTEMZaheer Abbasi
 
Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital ElectronicsJanki Shah
 
Binary number system
Binary number systemBinary number system
Binary number systemNadeem Uddin
 
Floating point representation
Floating point representationFloating point representation
Floating point representationmissstevenson01
 
PPT ON NUMBER SYSTEM
PPT ON NUMBER SYSTEMPPT ON NUMBER SYSTEM
PPT ON NUMBER SYSTEMRishabh Kanth
 
Integer Representation
Integer RepresentationInteger Representation
Integer Representationgavhays
 
Number system
Number systemNumber system
Number systemkashee99
 
Number system
Number systemNumber system
Number systemSajib
 
Complement in DLD
Complement in DLDComplement in DLD
Complement in DLDshahzad ali
 
Binaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemesBinaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemesDr. Anita Goel
 
Floating point presentation
Floating point presentationFloating point presentation
Floating point presentationSnehalataAgasti
 
Digital Electronics- Number systems & codes
Digital Electronics- Number systems & codes Digital Electronics- Number systems & codes
Digital Electronics- Number systems & codes VandanaPagar1
 
Csc1401 lecture03 - computer arithmetic - arithmetic and logic unit (alu)
Csc1401   lecture03 - computer arithmetic - arithmetic and logic unit (alu)Csc1401   lecture03 - computer arithmetic - arithmetic and logic unit (alu)
Csc1401 lecture03 - computer arithmetic - arithmetic and logic unit (alu)IIUM
 

What's hot (20)

Chapter 1 digital systems and binary numbers
Chapter 1 digital systems and binary numbersChapter 1 digital systems and binary numbers
Chapter 1 digital systems and binary numbers
 
Binary arithmetic
Binary arithmeticBinary arithmetic
Binary arithmetic
 
Number System
Number SystemNumber System
Number System
 
BINARY NUMBER SYSTEM
BINARY NUMBER SYSTEMBINARY NUMBER SYSTEM
BINARY NUMBER SYSTEM
 
Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital Electronics
 
Complements
ComplementsComplements
Complements
 
Binary number system
Binary number systemBinary number system
Binary number system
 
Floating point representation
Floating point representationFloating point representation
Floating point representation
 
1s and 2s complement
1s and 2s complement1s and 2s complement
1s and 2s complement
 
PPT ON NUMBER SYSTEM
PPT ON NUMBER SYSTEMPPT ON NUMBER SYSTEM
PPT ON NUMBER SYSTEM
 
Integer Representation
Integer RepresentationInteger Representation
Integer Representation
 
Number system
Number systemNumber system
Number system
 
Number system
Number systemNumber system
Number system
 
Complement in DLD
Complement in DLDComplement in DLD
Complement in DLD
 
Binary Arithmetic Operations
Binary Arithmetic OperationsBinary Arithmetic Operations
Binary Arithmetic Operations
 
Binaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemesBinaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemes
 
Floating point presentation
Floating point presentationFloating point presentation
Floating point presentation
 
Digital Electronics- Number systems & codes
Digital Electronics- Number systems & codes Digital Electronics- Number systems & codes
Digital Electronics- Number systems & codes
 
BINARY SUBTRACTION
BINARY SUBTRACTIONBINARY SUBTRACTION
BINARY SUBTRACTION
 
Csc1401 lecture03 - computer arithmetic - arithmetic and logic unit (alu)
Csc1401   lecture03 - computer arithmetic - arithmetic and logic unit (alu)Csc1401   lecture03 - computer arithmetic - arithmetic and logic unit (alu)
Csc1401 lecture03 - computer arithmetic - arithmetic and logic unit (alu)
 

Viewers also liked

Number system
Number systemNumber system
Number systemaviban
 
Class9 number system
Class9  number systemClass9  number system
Class9 number systemShija John
 
Programed instructional material: Basics of Trignometry
Programed instructional material: Basics of TrignometryProgramed instructional material: Basics of Trignometry
Programed instructional material: Basics of TrignometryAtul Thakur
 
Digital and Logic Design Chapter 1 binary_systems
Digital and Logic Design Chapter 1 binary_systemsDigital and Logic Design Chapter 1 binary_systems
Digital and Logic Design Chapter 1 binary_systemsImran Waris
 
Lines And Angles
Lines And AnglesLines And Angles
Lines And AnglesNMSpirit
 
Oprations Of Decimal Numbers
Oprations Of Decimal NumbersOprations Of Decimal Numbers
Oprations Of Decimal NumbersNMSpirit
 
Geometry formula-sheet
Geometry formula-sheetGeometry formula-sheet
Geometry formula-sheetadheera dra
 
Chapter5 data handling grade 8 cbse
Chapter5  data handling grade 8 cbseChapter5  data handling grade 8 cbse
Chapter5 data handling grade 8 cbsehtanny
 
Basic Mensuration
Basic MensurationBasic Mensuration
Basic MensurationKaran Bora
 
Ratio and proportion
Ratio and proportionRatio and proportion
Ratio and proportionjethrod13
 
Ratio And Proportion Powerpoint
Ratio And Proportion PowerpointRatio And Proportion Powerpoint
Ratio And Proportion Powerpointmibial
 
Ratio and proportion
Ratio and proportion Ratio and proportion
Ratio and proportion Glenda Dizon
 
number system
number systemnumber system
number systemvirly dwe
 

Viewers also liked (20)

Number system
Number systemNumber system
Number system
 
Class9 number system
Class9  number systemClass9  number system
Class9 number system
 
Programed instructional material: Basics of Trignometry
Programed instructional material: Basics of TrignometryProgramed instructional material: Basics of Trignometry
Programed instructional material: Basics of Trignometry
 
Digital and Logic Design Chapter 1 binary_systems
Digital and Logic Design Chapter 1 binary_systemsDigital and Logic Design Chapter 1 binary_systems
Digital and Logic Design Chapter 1 binary_systems
 
REAL NUMBERS
REAL NUMBERSREAL NUMBERS
REAL NUMBERS
 
Formula sheet
Formula sheetFormula sheet
Formula sheet
 
Number system
Number systemNumber system
Number system
 
Lines And Angles
Lines And AnglesLines And Angles
Lines And Angles
 
Oprations Of Decimal Numbers
Oprations Of Decimal NumbersOprations Of Decimal Numbers
Oprations Of Decimal Numbers
 
Real numbers system
Real numbers systemReal numbers system
Real numbers system
 
Geometry formula-sheet
Geometry formula-sheetGeometry formula-sheet
Geometry formula-sheet
 
Chapter5 data handling grade 8 cbse
Chapter5  data handling grade 8 cbseChapter5  data handling grade 8 cbse
Chapter5 data handling grade 8 cbse
 
Basic Mensuration
Basic MensurationBasic Mensuration
Basic Mensuration
 
Ratio and proportion
Ratio and proportionRatio and proportion
Ratio and proportion
 
Decimal Numbers
Decimal NumbersDecimal Numbers
Decimal Numbers
 
08. Numeral Systems
08. Numeral Systems08. Numeral Systems
08. Numeral Systems
 
Ratio And Proportion Powerpoint
Ratio And Proportion PowerpointRatio And Proportion Powerpoint
Ratio And Proportion Powerpoint
 
Ratio and proportion
Ratio and proportion Ratio and proportion
Ratio and proportion
 
Number system
Number systemNumber system
Number system
 
number system
number systemnumber system
number system
 

Similar to Slide03 Number System and Operations Part 1

Binary octal
Binary octalBinary octal
Binary octaldrdipo4
 
Chapter 2_Number system (EEEg4302).pdf
Chapter 2_Number system (EEEg4302).pdfChapter 2_Number system (EEEg4302).pdf
Chapter 2_Number system (EEEg4302).pdfTamiratDejene1
 
Data representation
Data representationData representation
Data representationChew Hoong
 
Binary reference guide csit vn1202
Binary reference guide csit vn1202Binary reference guide csit vn1202
Binary reference guide csit vn1202jrwalker2012
 
Logic Design - Chapter 1: Number Systems and Codes
Logic Design - Chapter 1: Number Systems and CodesLogic Design - Chapter 1: Number Systems and Codes
Logic Design - Chapter 1: Number Systems and CodesGouda Mando
 
digital-electronics.pptx
digital-electronics.pptxdigital-electronics.pptx
digital-electronics.pptxsulekhasaxena2
 
Chapter 02 Data Types
Chapter 02   Data TypesChapter 02   Data Types
Chapter 02 Data TypesNathan Yeung
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.pptRabiaAsif31
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.pptssuser52a19e
 
Review on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and HexadecimalReview on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and HexadecimalUtkirjonUbaydullaev1
 

Similar to Slide03 Number System and Operations Part 1 (20)

ch2.pdf
ch2.pdfch2.pdf
ch2.pdf
 
Binary octal
Binary octalBinary octal
Binary octal
 
Number system
Number systemNumber system
Number system
 
Chapter 2_Number system (EEEg4302).pdf
Chapter 2_Number system (EEEg4302).pdfChapter 2_Number system (EEEg4302).pdf
Chapter 2_Number system (EEEg4302).pdf
 
L2 number
L2 numberL2 number
L2 number
 
Data representation
Data representationData representation
Data representation
 
Binary reference guide csit vn1202
Binary reference guide csit vn1202Binary reference guide csit vn1202
Binary reference guide csit vn1202
 
unit-2_DL.pdf
unit-2_DL.pdfunit-2_DL.pdf
unit-2_DL.pdf
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
Number system
Number systemNumber system
Number system
 
Logic Design - Chapter 1: Number Systems and Codes
Logic Design - Chapter 1: Number Systems and CodesLogic Design - Chapter 1: Number Systems and Codes
Logic Design - Chapter 1: Number Systems and Codes
 
digital-electronics.pptx
digital-electronics.pptxdigital-electronics.pptx
digital-electronics.pptx
 
Pp02
Pp02Pp02
Pp02
 
2's complement
2's complement2's complement
2's complement
 
Chapter 02 Data Types
Chapter 02   Data TypesChapter 02   Data Types
Chapter 02 Data Types
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
computer Unit 2
computer Unit 2computer Unit 2
computer Unit 2
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
Review on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and HexadecimalReview on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and Hexadecimal
 

More from อภิเษก หงษ์วิทยากร

More from อภิเษก หงษ์วิทยากร (18)

Slide02 digital logic operations and functions
Slide02 digital logic operations and functionsSlide02 digital logic operations and functions
Slide02 digital logic operations and functions
 
Slide01 digital fundamental
Slide01 digital fundamentalSlide01 digital fundamental
Slide01 digital fundamental
 
00 course intro
00 course intro00 course intro
00 course intro
 
08 multimedia delivering
08 multimedia delivering08 multimedia delivering
08 multimedia delivering
 
07 animation
07 animation07 animation
07 animation
 
06 vdo
06 vdo06 vdo
06 vdo
 
05 audio
05 audio05 audio
05 audio
 
04 image andgraphics
04 image andgraphics04 image andgraphics
04 image andgraphics
 
02 multimedia andinteractivity
02 multimedia andinteractivity02 multimedia andinteractivity
02 multimedia andinteractivity
 
01 fundamental of multimedia
01 fundamental of multimedia01 fundamental of multimedia
01 fundamental of multimedia
 
00 welcome slide
00 welcome slide00 welcome slide
00 welcome slide
 
03 digital mediafundamental
03 digital mediafundamental03 digital mediafundamental
03 digital mediafundamental
 
Slide05 Message Passing Architecture
Slide05 Message Passing ArchitectureSlide05 Message Passing Architecture
Slide05 Message Passing Architecture
 
Slide06 Networked Computing
Slide06 Networked ComputingSlide06 Networked Computing
Slide06 Networked Computing
 
03 digital mediafundamental
03 digital mediafundamental03 digital mediafundamental
03 digital mediafundamental
 
03 digital media fundamental
03 digital media fundamental03 digital media fundamental
03 digital media fundamental
 
02 multimedia andinteractivity
02 multimedia andinteractivity02 multimedia andinteractivity
02 multimedia andinteractivity
 
01 fundamental of multimedia
01 fundamental of multimedia01 fundamental of multimedia
01 fundamental of multimedia
 

Recently uploaded

Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroom6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroomSamsung Business USA
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
How to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command LineHow to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command LineCeline George
 
Sulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesSulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesVijayaLaxmi84
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Osopher
 

Recently uploaded (20)

Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroom6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroom
 
Introduction to Research ,Need for research, Need for design of Experiments, ...
Introduction to Research ,Need for research, Need for design of Experiments, ...Introduction to Research ,Need for research, Need for design of Experiments, ...
Introduction to Research ,Need for research, Need for design of Experiments, ...
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
How to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command LineHow to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command Line
 
Sulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesSulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their uses
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
Spearman's correlation,Formula,Advantages,
Spearman's correlation,Formula,Advantages,Spearman's correlation,Formula,Advantages,
Spearman's correlation,Formula,Advantages,
 
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 

Slide03 Number System and Operations Part 1

  • 1. Number Systems & Operations Part I 19 พฤศจิกายน 2555
  • 2. Decimal Numbers (Base 10) People use decimal numbers. I hope you know this very well. However, let’s review:  Ten digits  0-9  The value of a digit is determined by its position in the number. . . . 102101100.10-110-210-3 . . .
  • 3. Binary Numbers Decimal Binary 0 0 1 1 2 10 3 11 There are only 2 digits 4 100 (0 and 1) and we can 5 101 do binary counting as 6 110 shown in the table. 7 111 8 1000 9 1001 10 1010
  • 4. Binary Numbers (Base 2) The weighting structure of binary numbers 2Positive power 23two 21 20 n-1 . . . of 22 .2Negative . . . two 2 power of 2 -1 -2 -n (whole number) (fractional number) 25 24 23 22 21 20 2-1 2-2 2-3 2-4 2-5 2-6 32 16 8 4 2 1 1/2 1/4 1/8 1/16 1/32 1/64 0.5 0.25 0.125 0.0625 0.03125 0.015625
  • 5. Binary-to-Decimal Conversion Add the weights of all 1s in a binary number to get the decimal value. ex: convert 11011012 to decimal Weight 26 25 24 23 22 21 20 bin 1 1 0 1 1 0 1 11011012 ! = 26 + 25 + 23 + 22 + 20 ! ! ! = 64 + 32 + 8 + 4 + 1 ! ! ! = 109
  • 6. Binary-to-Decimal Conversion Fractional binary example ex: convert 0.1011 to decimal Weight 2-1 2-2 2-3 24 bin 1 0 1 1 0.1011 != 2-1 + 2-3 + 2-4 ! ! ! = 0.5 + 0.125 + 0.0625 ! ! ! = 0.6875
  • 7. Decimal-to-Binary Conversion Sum-of-weights method  To get the binary number for a given decimal number, find the binary weights that add up to the decimal number. ex: convert 1210 , 2510 , 5810 , 8210 to binary ! 12 = 8+4 = 23+22 = 1100 ! 25 = 16+8+1 = 24+23+20 = 11001 ! 58 = 32+16+8+2 = 25+24+23+21 = 111010 ! 82 = 64+16+2 = 26+24+21 = 1010010
  • 8. Decimal-to-Binary Conversion Repeated division-by-2 remainder method 12/2 = 6 0 LSB  To get the binary number for a given 6/2 = 3 0 decimal number, divide the decimal number by 3/2 = 1 1 2 until the quotient is 0. 1/2 = 0 1 MSB Remainders form the binary number. Stop when the whole-number quotient is 0 1210 = 11002
  • 9. Decimal-to-Binary Conversion Converting decimal fractions to binary  Sum-of-weights This method can be applied to fractional decimal numbers, as shown in the following example: ! 0.625 = 0.5+0.125 = 2-1+2-3 = 0.101  Repeated multiplication by 2 Decimal fraction can be converted to binary by repeated multiplication by 2 (see details in the following slide.)
  • 10. Repeated Multiplication by 2 (by example) ex: convert the decimal fraction 0.3125 to binary carry 0.3125 x 2 = 0.625 0 MSB 0.625 x 2 = 1.25 1 0.25 x 2 = 0.50 0 0.50 x 2 = 1.00 1 LSB Continue to the desired number of decimal places or stop when the fractional part is all zero 0.312510 = 0.01012
  • 11. Binary Arithmetic Basic of binary arithmetic  Binary addition  Binary subtraction  Binary multiplication  Binary division
  • 12. Binary Addition The four basic rules for adding digits are as follows:  0+0=0  sum of 0 with a carry of 0  0+1=1  sum of 1 with a carry of 0  1+0=1  sum of 1 with a carry of 0  1+1=10  sum of 0 with a carry of 1
  • 13. Binary Addition (by example) 11 3 100 4 +11 +3 + 10 +2 110 6 110 6 111 7 110 6 + 11 +3 +100 +4 1010 10 1010 10
  • 14. Binary Subtraction The four basic rules for subtracting digits are as follows:  0-0 = 0  1-1 = 0  1-0 = 1  10-1 = 1 ; 0-1 with a borrow of 1
  • 15. Binary Subtraction (by example) 11 3 11 3 -01 -1 -10 -2 10 2 01 1 101 5 -011 -3 010 2
  • 16. Binary Multiplication The four basic rules for multiplying digits are as follows:  0x0 = 0  0x1 = 0  1x0 = 0  1x1 = 1 Multiplication is performed with binary numbers in the same manner as with decimal numbers.  It involves forming partial products, shifting each successive partial product left one place, and then adding all the partial products.
  • 17. Binary Multiplication (by example) 11 3 101 5 x11 x3 x111 x7 11 9 101 35 +11 101 1001 +101 100011
  • 18. Binary Division Division in binary follows the same procedure as division in decimal. 10 2 11 3 11 110 3 6 10 110 2 6 11 6 10 6 000 0 10 0 10 00
  • 19. 1’s and 2’s Complements They are important since they permit the presentation of negative numbers. The method of 2’s complement arithmetic is commonly used in computers to handle negative numbers.
  • 20. Finding the 1’s complement Very simple: change each bit in a number to get the 1’s complement ex: find 1’s complement of 111001012 Binary 1 1 1 0 0 1 0 1 1’s complement 0 0 0 1 1 0 1 0
  • 21. Finding the 2’s Complement Add 1 to the 1’s complement to get the 2’s complement. +1 ex: 10110010  01001101  01001110 1’s complement 2’s complement An alternative method:  Start at the right with the LSB and write the bits as they are up to and including the first 1.  Take the 1’s complement of the remaining bits. 10110010!! 10111000!binary ! ! ! 01001110!! 01001000!2’s comp
  • 22. Signed Numbers Digital systems, such as computer, must be able to handle both positive and negative numbers. A signed binary number consists of both sign and magnitude information.  The sign indicates whether a number is positive or negative.  The magnitude is the value of the number.
  • 23. Signed Numbers There are 3 forms in which signed integer numbers can be represented in binary:  Sign-magnitude (least used)  1’s complement  2’s complement (most important) Non-integer and very large or small numbers can be expressed in floating-point format.
  • 24. The Sign Bit The left-most bit in a signed binary number is the sign bit.  It tells you whether the number is positive (sign bit = 0) or negative (sign bit = 1).
  • 25. Sign-Magnitude Form The left-most bit is the sign bit and the remaining bits are the magnitude bits.  The magnitude bits are in true binary for both positive and negative numbers. ex: the decimal number +25 is expressed as an 8-bit signed binary number as: 00011001 While the decimal number -25 is expressed as 10011001
  • 26. Sign-Magnitude Form “ In the sign-magnitude form, a negative number has the same magnitude bits as the corresponding positive number but the sign bit is a 1 rather than a 0. “
  • 27. 1’s Complement Form Positive numbers in 1’s complement form are represented the same way as the positive sign-magnitude. Negative numbers are the 1’s complements of the corresponding positive numbers. ex: the decimal number +25 is expressed as: 00011001 While the decimal number -25 is expressed as 11100110
  • 28. 1’s Complement Form “ In the 1’s complement form, a negative number is the 1’s complement of the corresponding positive number. “
  • 29. 2’s Complement Form Positive numbers in 2’s complement form are represented the same way as the positive sign-magnitude and 1’s complement form. Negative numbers are the 2’s complements of the corresponding positive numbers. ex: the decimal number +25 is expressed as: 00011001 While the decimal number -25 is expressed as 11100111
  • 30. 2’s Complement Form “ In the 2’s complement form, a negative number is the 2’s complement of the corresponding positive number. “
  • 31. Decimal Value of Signed Numbers Sign-magnitude:  Both positive and negative numbers are determined by summing the weights in all the magnitude bit positions where these are 1s and ignoring those positions where there are 0s.  The sign is determined by examination of the sign bit.
  • 32. Decimal Value of Signed Numbers Sign-magnitude (by example) ex: decimal values of these numbers (expressed in sign-magnitude) 1) 10010101 2) 01110111 1) 10010101 2) 01110111 magnitude magnitude 26 25 24 23 22 21 20 26 25 24 23 22 21 20 ! 0 0 1 0 1 0 1 1 1 1 0 1 1 1 ! = 16+4+1 = 21 = 64+32+16+4+2+1 = 119 ! sign sign ! = 1  negative = 0  positive ! Hence: 10010101 = -21 Hence: 01110111 = 119
  • 33. Decimal Value of Signed Numbers 1’s complement:  Positive – determined by summing the weights in all bit positions where there are 1s and ignoring those positions where there are 0s.  Negative – determined by assigning a negative value to the weight of the sign bit, summing all the weights where there are 1’s, and adding 1 to the result.
  • 34. Decimal Value of Signed Numbers 1’s complement (by example) ex: decimal values of these numbers (expressed in 1’s complement) 1) 00010111 2) 11101000 1) 00010111 2) 11101000 -27 26 25 24 23 22 21 20 -27 26 25 24 23 22 21 20 ! 0 0 0 1 0 1 1 1 1 1 1 0 1 0 0 0 ! ! = 16+4+2+1 = +23 = (-128)+64+32+8 = -24 ! +1 ! Hence: 00010111 = +23 Hence: 11101000 = -23
  • 35. Decimal Value of Signed Numbers 2’s complement:  Positive – determined by summing the weights in all bit positions where there are 1s and ignoring those positions where there are 0s.  Negative – the weight of the sign bit in a negative number is given a negative value.
  • 36. Decimal Value of Signed Numbers 2’s complement (by example) ex: decimal values of these numbers (expressed in 2’s complement) 1) 01010110 2) 10101010 1) 01010110 2) 10101010 -27 26 25 24 23 22 21 20 -27 26 25 24 23 22 21 20 ! 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 ! = 64+16+4+2 = +86 = (-128)+32+8+2 = -86 ! Hence: 01010110 = +86 Hence: 10101010 = -86
  • 37. Range of Signed Integer Numbers The range of magnitude of a binary number depends on the number of bits (n). Total combinations = 2n  8 bits = 256 different numbers  16 bits = 65,536 different numbers  32 bits = 4,294,967,296 different numbers
  • 38. Range of Signed Integer Numbers For 2’s complement signed numbers:  Range = -(2n-1) to +(2n-1-1)  where there is one sign bit and n-1 magnitude ex: Negative Positive Boundary Boundary 4 bits -(23) = -8 (23-1) = +7 8 bits -(27) = -128 (27-1) = +127 16 bits -(215) = -32,768 (215-1) = +32767
  • 39. Floating-point numbers How many bits do we need to represent very large number? Floating-point number consists of two parts plus a sign.  Mantissa – represents the magnitude of the number.  Exponent – represents the number of places that the decimal point (or binary point) is to be moved.  Decimal number example: 241,506,800 Mantissa = 0.2415068 Exponent = 109 Can be written as FP as 0.2415068 x 109
  • 40. Binary FP Numbers The format defined by ANSI/IEEE Standard 754-1985  Single-precision  Double-precision  Extended-precision Same basic formats except for the number of bits.  Single-precision = 32 bits  Double-precision = 64 bits  (Double) Extended-precision = 80 bits
  • 41. Single-Precision Floating-Point Binary Numbers Standard format:  Sign bit (S) – 1 bit  Exponent (E) – 8 bits  Mantissa or fraction (F) – 23 bits S(1) E(8) F(23) Single-precision FP Binary Number Format
  • 42. Single-Precision Floating-Point Binary Numbers Mantissa  The binary point is understood to be to the left of the 23 bits.  Effectively, there are 24 bits in the mantissa because in any binary number the left most bit is always 1. (say 001101100 is 1101100.)  Therefore, this 1 is understood to be there although it does not occupy an actual bit position. S(1) E(8) F(23) Single-precision FP Binary Number Format
  • 43. Single-Precision Floating-Point Binary Numbers Exponent  The eight bits represent a biased exponent which is obtained by adding 127.  The purpose of the bias is to allow very large or very small numbers without requiring a separate sign bit for the exponents.  The biased exp allows a range of actual exp values from -126 (000000012) to +128 (111111102) S(1) E(8) F(23) Single-precision FP Binary Number Format
  • 44. Single-Precision Floating-Point Binary Numbers Not easy, is it? Let’s see an example. ex: 10110100100012 (assumption: positive number) It can be expressed as 1 plus a fractional binary number. Hence: 1011010010001 = 1.011010010001 x 212 The exponent,12, is expressed as a biased exponent as followed: 12+127 = 139 = 10001011 Therefore, we get: 0 10001011 01101001000100000000000
  • 45. Single-Precision Floating-Point Binary Numbers Let’s do the opposite way:  To evaluate a binary number in FP format.  General formula: ! Number = (-1)S(1+F)(2E-127) ex: 1 10010001 10001110001000000000000 Number = (-1)(1.10001110001)(2145-127) ! ! ! = (-1)(1.10001110001)(218) ! ! ! = -11000111000100000002
  • 46. Single-Precision Floating-Point Binary Numbers Let’s review:  The exponent can be any number between -126 to +128; that means extremely large and small numbers can be expressed.  Say, a 32-bit FP number can replace a binary integer number having 129 bits.  Distinctive point: Because the exponent determines the position of the binary point, numbers containing both integer and fractional parts can be represented.
  • 47. Single-Precision Floating-Point Binary Numbers There are 2 exceptions to the format for FP numbers:  The number 0.0 is represented by all 0s. x 00000000 00000000000000000000000  Infinity is represented by all 1s in the exponent and all 0s in the mantissa. x 11111111 00000000000000000000000