Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
9/15/2009 4
Decimal Binary BCD (Binary-Coded Decimal) 68 = 0100 0100 = 0110 1000 = 2^6 + 2^2 = 64 + 4 = 68 = 2^2 + 2^1 = 6 23 = 8 99 (largest 8-bit BCD) = 0110 0011 = 1001 1001 = 2^6 + 2^5 + 2^1 + 2^0 = = 64 + 32 + 2 + 1 = 99 = 2^3 + 2^0 23 + 2^0 = 9 9 255 (largest 8-bit binary) = 1111 1111 = 0010 0101 0101 = 2 8
No. of Bits BCD Range Binary Range 4 0-9 1 digit 0-15 1+ digit 8 0-99 2 digits 0-255 2+ digits 12 0-999 3 digits 0-4,095 3+ digits 16 0-9,999 4 digits 0-65,535 4+ digits 20 0-99,999 5 digits 0-1 million 6 digits 24 0-999,999 6 digits 0-16 million 7+ digits 32 0-99,999,999 8 digits 0-4 billion 9+ digits 64 0-(10^16 -1) 16 digits 0-16 quintillion 19+ digits
(^) Sign-and-magnitude algorithms complex and difficult to implement in hardware (^) Must test for 2 values of 0 (^) Useful with BCD (^) Order of signed number and carry/borrow makes a difference (^) Example: Decimal addition algorithm
9/15/2009 13
(^) Taking the complement : subtracting a value from a standard basis value (^) Decimal (base 10) system diminished radix complement (^) Radix minus 1 = 10 – 1 9 as the basis (^) 3-digit example: base value = 999 (^) Range of possible values 0 to 999 arbitrarily split at 500 Numbers Negative Positive Representation method Complement Number itself Range of decimal numbers -499 -000 +0 499 Calculation 999 minus number none Representation example 500 999 0 499 999 – 499
0
0 Representatio n 500 649 899 999 0 170 420 499 Number represented
- 499 **_- 350
100_** - 000 0 170 420 499
0
0
9 Representatio n 500 999 0 200 499 500 899 999 Number represented
000 0 200 499 - 499 - 100
Wrong Answer!! + Representation 500 898 999 0 200 499 Number represented -499 -101 -000 0 200 499
(^) Taking the complement : subtracting a value from a standard basis value
(^) Inversion: change 1’s to 0’s and 0’s to 1s
(^) Example with 8-bit binary numbers Numbers Negative Positive Representation method Complement Number itself Range of decimal numbers -127 10 -0 10 +0 10 12710 Calculation Inversion None Representation example 10000000 11111111 0000000 0111111