R.M. Dansereau; v.1.0INTRO. TO COMP. ENG.CHAPTER V-1NUMBERS & ARITHMETIC•CHAPTER VCHAPTER VNUMBER SYSTEMS AND ARITHMETICR.M. Dansereau; v.1.0INTRO. TO COMP. ENG.CHAPTER V-2NUMBER SYSTEMSRADIX-R REPRESENTATIONNUMBERS & ARITHMETIC•NUMBER SYSTEMS•Decimal number expansion•Binary number representation•Hexadecimal number representation73625107104×()3103×()6102×()2101×()5100×()++++=101102124×()023×()122×()121×()020×()++++2210==3E4B8163164×()14 163×()4162×()11 161×()8160×()++++= 25516010=R.M. Dansereau; v.1.0INTRO. TO COMP. ENG.CHAPTER V-3NUMBER SYSTEMSDECIMAL REPRESENTATIONNUMBERS & ARITHMETIC•NUMBER SYSTEMS-NUMBER REPRES.103102101100101–102–103–104–73 25.438573625.4385107104×()3103×()6102×()2101×()5100×()++++=6104105105–00 4101–×()3102–×()8103–×()5104–×()++++... ...73625.438510Radix-10 RepresentationR.M. Dansereau; v.1.0INTRO. TO COMP. ENG.CHAPTER V-4NUMBER SYSTEMSBINARY REPRESENTATIONNUMBERS & ARITHMETIC•NUMBER SYSTEMS-NUMBER REPRES.-DECIMAL REPRES.LSBMSB2322212021–22–23–24–10 10.001110110.00112124×()023×()122×()121×()020×()++++=1242525–00 021–×()022–×()123–×()124–×()++++... ...10110.00112 22.187510=Radix-2 RepresentationR.M. Dansereau; v.1.0INTRO. TO COMP. ENG.CHAPTER V-5NUMBER SYSTEMSOCTAL REPRESENTATIONNUMBERS & ARITHMETIC•NUMBER SYSTEMS-NUMBER REPRES.-DECIMAL REPRES.-BINARY REPRES.8382818081–82–83–84– 26 16.173126516.17318284×()683×()582×()181×()680×()++++=5848585–00 181–×()782–×()383–×()184–×()++++... ...26516.17318 11598.2410=Radix-8 RepresentationR.M. Dansereau; v.1.0INTRO. TO COMP. ENG.CHAPTER V-6NUMBER SYSTEMSHEXADECIMAL REPRES.NUMBERS & ARITHMETIC•NUMBER SYSTEMS-DECIMAL REPRES.-BINARY REPRES.-OCTAL REPRES.163162161160161–162–163–164–19 D6.F41119AD6.F411161164×()9163×()A162×()D161×()6160×()++++=A164165165–00 F161–×()4162–×()1163–×()1164–×()++++... ...19AD6.F41116 105174.9510≈Radix-16 RepresentationR.M. Dansereau; v.1.0INTRO. TO COMP. ENG.CHAPTER V-7NUMBER SYSTEMSBINARY <-> HEXADECIMALNUMBERS & ARITHMETIC•NUMBER SYSTEMS-BINARY REPRES.-OCTAL REPRES.-HEXADECIMAL REPRES.BINARY <-> HEXADECIMALGroup binary by 4 bits from radix point00002 = 01600012 = 11600102 = 21600112 = 31601002 = 41601012 = 51601102 = 61601112 = 71610002 = 81610012 = 91610102 = 10 (A16)10112 = 11 (B16)11002 = 12 (C16)11012 = 13 (D16)11102 = 14 (E16)11112 = 15 (F16)10 1010 0110.1100 012 = 2A6.C4160111 10112 = 7B16Examples:A67BBINARY -> HEXADECIMALC 42R.M. Dansereau; v.1.0INTRO. TO COMP. ENG.CHAPTER V-8NUMBER SYSTEMSBINARY <-> OCTALNUMBERS & ARITHMETIC•NUMBER SYSTEMS-BINARY REPRES.-OCTAL REPRES.-BINARY<->HEXADECIMALBINARY <-> OCTALGroup binary bits by 3 from LSB0002 = 080012 = 180102 = 280112 = 381002 = 481012 = 581102 = 681112 = 7810 100 1102 = 246810 101 111 011.011 112 = 2573.3682BINARY -> OCTALExamples:465732 3 6R.M. Dansereau; v.1.0INTRO. TO COMP. ENG.CHAPTER V-9NUMBER SYSTEMSBINARY -> DECIMALNUMBERS & ARITHMETIC•NUMBER SYSTEMS-OCTAL REPRES.-BINARY<->HEXADECIMAL-BINARY<->OCTAL•Perform radix-2 expansion• Multiply each bit in the binary number by 2 to the power of its place. Then sum all of the values to get the decimal value.101112124×()023×()122×()121×()120×()++++2310==Examples:10110.00112124×()023×()122×()121×()020×()++++= 021–×()022–×()123–×()124–×()++++ 22.187510=R.M. Dansereau; v.1.0INTRO. TO COMP. ENG.CHAPTER V-10NUMBER SYSTEMSDECIMAL -> BINARYNUMBERS & ARITHMETIC•NUMBER SYSTEMS-BINARY<->HEXADECIMAL-BINARY<->OCTAL-BINARY->DECIMALExample:41 mod 21=20 mod 20=10 mod 20=5 mod 21=2 mod 20=1 mod 21=LSBMSBTherefore41.82812510101001.1101012=Convert41.828125100.828125 2×1.65625=0.65625 2×1.3125=0.3125 2×0.625=0.625 2×1.25=0.25 2×0.5=0.5 2×1.0=MSBLSB•Integer part:• Modulo division of decimal integer by 2 to get each bit, starting with LSB.•Fraction part:• Multiplication decimal fraction by 2 and collect resulting integers, starting with MSB.R.M. Dansereau; v.1.0INTRO. TO COMP. ENG.CHAPTER V-11NUMBER SYSTEMSFLOATING POINT NUMBERSNUMBERS & ARITHMETIC•NUMBER SYSTEMS-BINARY<->HEXADECIMAL-BINARY->DECIMAL-DECIMAL->BINARY•Floating point numbers can be represented with a sign bit, a fraction (often referred to as the mantissa), and an exponent.• Example 1: , where the sign is negative, the fraction is and the exponent is .• Example 2: , where the sign is positive, the fraction is , and the exponent is .•Sample IEEE Floating-Point Formats267.426–0.267426 103×–=0.267426 30101011.1001 0.1010111 26×=0.1010111 011018 23111 52se f64-bit32-bitse fR.M. Dansereau; v.1.0INTRO. TO COMP. ENG.CHAPTER V-12BINARY NUMBERSUNSIGNED INTEGERNUMBERS & ARITHMETIC•NUMBER SYSTEMS-DECIMAL->BINARY-POWERS OF 2-FLOATING POINT•The range for an -bit radix- unsigned integer is• Example: For a 16-bit binary unsigned integer, the range iswhich has a binary representation of 0000 0000 0000 0000 = 0 0000 0000 0000 0001 = 1 0000 0000 0000 0010 = 2 . . . 1111 1111 1111 1110 = 65534 1111 1111 1111 1111 = 65535nr0r10n1–,[]02161–,[]0 65535,[]=R.M. Dansereau; v.1.0INTRO. TO COMP. ENG.CHAPTER V-13BINARY NUMBERSSIGNED INTEGERS (1)NUMBERS & ARITHMETIC•NUMBER SYSTEMS•BINARY NUMBERS-UNSIGNED INTEGERS•The range for an -bit radix- signed integer is• The most-significant bit is used as a sign bit, where 0 indicates a positive integer and 1 indicates a negative integer.Example: For a 16-bit binary signed integer, the range isnrr10n1––r10n1–1–,[]216 1––216 1–1–,[]32768 32767,–[]=R.M. Dansereau; v.1.0INTRO. TO COMP. ENG.CHAPTER V-14BINARY NUMBERSSIGNED INTEGERS (2)NUMBERS & ARITHMETIC•NUMBER SYSTEMS•BINARY NUMBERS-UNSIGNED INTEGERS-SIGNED INTEGERS•There are a number of different representations for signed integers, each which has its own advantage• Signed-magnitude representation:• 1010 0001 0110 1111• Signed-1’s complement representation:• 1101 1110 1001 0000• Signed-2’s complement representation:• 1101 1110 1001 0001•The above examples are all the same number, .855910–R.M. Dansereau; v.1.0INTRO. TO COMP. ENG.CHAPTER V-15BINARY NUMBERSSIGNED-MAGNITUDENUMBERS & ARITHMETIC•NUMBER SYSTEMS•BINARY NUMBERS-UNSIGNED INTEGERS-SIGNED INTEGERS•The signed-magnitude binary integer representation is just like the unsigned representation with the addition of a sign bit.• For instance, using 8-bits, the number can be represented as the7-bit
View Full Document