Upcoming SlideShare
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Standard text messaging rates apply

# MELJUN CORTES - Number Base

136

Published on

MELJUN CORTES - Number Base

MELJUN CORTES - Number Base

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total Views
136
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
10
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Transcript

• 1. Year 1 LESSON 1 NUMBER BASES♦ Human base • 10 • Ten finger • DECIMAL♦ Computer base • 2 • Two-state devices • BINARY • NUMBER SYMBOL♦ Base • Number of symbols • Number of “states” CS113/0401/v1 Lesson 1 - 1
• 2. Year 1POSITIONAL VALUES (1)♦ Decimal / Denary Positional value 100 10 1 Digit 2 5 8 258 =200+50+8 =2x100+5x10+8 x1 2 1 0 =2x10 +5x10 +8x10♦ Binary Positional value 32 16 8 4 2 1 Digit 1 1 0 1 0 1 Decimal value of binary 110101 (1 x 32) 32+ (1 x16) 16+ (0 x 8) 0+ (1 x 4) 4+ (0 x 2) 0+ (1 x 1) + 1 53 CS113/0401/v1 Lesson 1 - 2
• 3. Year 1POSITIONAL VALUES (2)Number Decimal Binary Octal HexadecimalSystemBase 10 2 8 16Digits 0 0 0 0Used 1 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 9 9 0 A B C D E F CS113/0401/v1 Lesson 1 - 3
• 4. Year 1POSITIONAL VALUES (3)♦ OctalPositional value 512 64 8 1 Digit 3 0 5 6Decimal value of octal 3056 + (3x512) 1536 + (0x64) 0 + (5x8 ) 40 + (6x1 ) + 6 1582 CS113/0401/v1 Lesson 1 - 4
• 5. Year 1 POSITION VALUES (4)♦ HexadecimalPositional value 4096 256 16 1 Digit 2 F A 6Decimal Value of hexadecimal 2FA6 (2x4096) 8192+ (Fx256) 15x256 3840+ (Ax16) 10x16 160+ (6x1) + 6 12198 CS113/0401/v1 Lesson 1 - 5
• 6. Year 1FRACTIONAL QUANTITIES (1)♦ Decimal Positional value 10 1 . 0.1 0.01 0.001 Digit 3 6 . 5 2 8♦ Binary Fractions (Decimals) Positional value 4 2 1 . 0.5 0.25 0.125 Digit 1 0 1 . 0 1 1 Decimal value of binary 101.011 (1 x 4) 4.0+ (0 x 2) 0.0+ (1 x 1) 1.0+ (0 x 0.5) 0.0+ (1 x 0.25) 0.25+ (1 x 0.125) + 0.125 5.375 CS113/0401/v1 Lesson 1 - 6
• 7. Year 1FRACTIONAL QUANTITIES (2)♦ Octal Fractions Positional value 8 1 . 0.125 0.015625 Digit 3 1 . 2 7 Decimal value of octal 31.27 (3 x 8) 24.0+ (1 x 1) 1.0+ (2 x 0.125) 0.25+ (7 x 0.015625) + 0.109375 25.359375 CS113/0401/v1 Lesson 1 - 7
• 8. Year 1FRACTIONAL QUANTITIES (3)♦ Hexadecimal Fractions Positional value . 0.0625 0.00390625 Digit . C F Decimal value of hexadecimal 0.CF (C x 0.0625) 12 x 0.0625 0.75+ (F x 0.0390625) 15 x 0.0390625 +0.05859375 0.80859375 CS113/0401/v1 Lesson 1 - 8
• 9. Year 1 CONVERSION FROMDECIMAL TO OTHER BASES (1) ♦ Divide by required base and note remainder ♦ Continue dividing quotients by required base until the answer is zero ♦ Write the remainder digits from right to left to give the answer 117 Decimal to Binary 2 ) 117 remainder 1 2 ) 58 “ 0 2 ) 29 “ 1 2 ) 14 “ 0 2) 7 “ 1 2) 3 “ 1 2) 1 “ 1 0 117 Decimal = 1 1 1 0 1 0 1 Binary CS113/0401/v1 Lesson 1 - 9
• 10. Year 1 CONVERSION FROMDECIMAL TO OTHER BASES (2) 236 Decimal to Octal 8 ) 236 remainder 4 8 ) 29 “ 5 8) 8 3 236 Decimal = 3 5 4 Octal 437 Decimal to Hexadecimal 16 ) 473 remainder 9 16 ) 29 “ 13 16 ) 1 “ 1 437 Decimal= 1 D 9 Hexadecimal Lesson 1 - 10 CS113/0401/v1
• 11. Year 1CONVERSION OF DECIMAL FRACTIONS (1)♦ Method • Multiply fraction part by base • Remove integer part of result as first digit of answer • Continue multiplying remaining fractional parts by the base and extracting the resulting integers as answer digits • Stop when answer contains enough digits for accuracy required, or when remaining fraction is zero • If remaining fraction is zero, the representation is exact CS113/0401/v1 Lesson 1 - 11
• 12. Year 1CONVERSION OF DECIMAL FRACTIONS (2)♦ DECIMAL TO BINARY 0.743 Decimal to Binary .743 x 2 1 .486 x 2 0 .972 x 2 1 .944 x 2 1 .888 x 2 1 .776 x 2 1 .552 x 2 1 .104 x 2 0 .208 0.1 0 1 1 1 1 1 0 Binary = 0.743 CS113/0401/v1 Lesson 1 - 12
• 13. Year 1CONVERSION OF DECIMAL FRACTIONS (3)♦ DECIMAL TO OCTAL • Use previous method outlined, but multiplying by 8 each time♦ DECIMAL TO HEXADECIMAL • Use previous method outlined, but multiplying by 16 each time • Remember that integer part can be bigger than 10 giving A to F in the answer CS113/0401/v1 Lesson 1 - 13
• 14. Year 1 BINARY, OCTAL AND HEXADECIMAL (1)♦ The three systems are closely related♦ Octal or hexadecimal are often used as shorthand for binary • Example : Store dumps♦ Group binary digits • in threes for octal • in fours for hexadecimal CS113/0401/v1 Lesson 1 - 14
• 15. Year 1 BINARY, OCTAL AND HEXADECIMAL (2)♦ Express each octal digit as three binary digits, or each hexadecimal digit as four binary digits, then write all the binary digit, as continuous string OCTAL 1 7 3 2 BINARY 001 111 011 010 HEX 3 D A♦ Add leading zeros (trailing zeroes to fractions) for clarity♦ To convert from octal to hexadeximal or vice-versa go via binary CS113/0401/v1 Lesson 1 - 15
• 16. Year 1 OCTAL ADDITION♦ The sum of two octal numbers can be deduced by the usual addition algorithm to the repeated addition of two digits ( with possibly a carry of 1 ).♦ The sum of two octal digits, or the sum of two octal digits plus 1, can be obtained by : i. Finding their decimal sum and ii. Modifying the decimal, if it exceeds 8 7, by subtracting 8 and carrying 1 to the next column.♦ Example: 58 + 6 8 + 28 = 15 8 58 + 68 28 Decimal sum 13 Modification - 8 Octal sum 158 CS113/0401/v1 Lesson 1 - 16
• 17. Year 1HEXADECIMAL ADDITION♦ The sum of two hexadecimal digits, or the sum of two hexadecimal digits plus 1, can be obtained by : i. Finding their decimal sum and ii. Modifying the decimal, if it exceeds 15, by subtracting 16 and carrying 1 to the next column.♦ Example : A16 + 916 A + 9 Decimal sum 19 Modification - 16 Octal sum 13 16 CS113/0401/v1 Lesson 1 - 17
• 18. Year 1 MODULAR ARTHMETIC♦ In our daily life, there are so many counting / measuring systems around us.♦ E.g. 100 cm is not the same as 100 inches, because measuring is different.♦ Example: “ If Peter starts work at 8 0’ clock in the morning and work for 8 hours, at what time will Peter finish work? ” Solution: Step 1. Add 8 hours to 8 o’ clock = ( 8 + 8 = 16 ) Step 2. 16 Divide by 12 ( because 12 hours ) = ( 16 mod 12 ) Step 3. The remainder is 4 = ( 16 mod 12 = 4 ) CS113/0401/v1 Lesson 1 - 18