05) mathematics for general computing.pptx

Post on 07-Jul-2016

218 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Mathematics for General Computing

Department of Mathematics &

Computer ScienceFaculty of Natural Sciences

The Open University of Sri Lanka

April 27, 2023 DMCS 1

What is a Number System? “A 'number system' is a set of numbers, (in

the broadest sense of the word), together with one or more operations, such as addition or multiplication” Wikipedia

Ex: Natural numbers, Integers, Rational Numbers, Complex numbers, Binary, Octal, Decimal, etc..

April 27, 2023 Sample footer 2

Decimal Number SystemContain 10 digits

0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Called as 10 base number system

April 27, 2023DMCS

3

3 2 7

102 101 100

10 x Bigger

Binary Number SystemWe use the decimal system in everyday life

because it seems more natural (we have ten fingers and ten toes).

For the computer, the binary system is more natural because of its electrical nature (On versus Off).

Has only two digits1, 0

April 27, 2023DMCS

4

Octal Number SystemContain 8 digits

0, 1, 2, 3, 4, 5, 6, 7Programs often display data in octal format

because it is relatively easy for humans to read

Easily be translated into binary formatBy contrast, decimal format is the easiest

format for humans to read, but translating between decimal and binary formats is relatively difficult. April 27, 2023

DMCS5

Hexadecimal Number SystemContain 16 digits

0, 1, 2, 3, 4, 5, 6, 7,8, 9, A, B, C, D, E, FEasier for humans to read hexadecimal

numbers than binary numbersHexadecimal numbers have either an 0x

prefix or an h suffix

April 27, 2023DMCS

6

Conversion between Number systemDecimal to binaryDecimal to OctalDecimal to HexadecimalBinary to DecimalOctal to DecimalHexadecimal to DecimalOctal to BinaryHexadecimal to Binary

April 27, 2023 DMCS7

Decimal to BinaryE.g.: convert decimal number 65 to binary

6510 = 1000001b

Sample footer 8

65232 - 1

216 - 0

2 8 - 0

2 4 - 0

2 2 - 0

2 1 - 0

Binary to Decimal 1 0 0 0 0 0 1

1 x 1 = 1 = 65

20

21

26

25

24

23

22 2

x 0= 0 +

4 x 0= 0 +

8 x 0 = 0 +

16x 0 =0 +

32x 0 = 0 +

64x 1 = 64 +

Decimal to OctalE.g.: convert decimal number 65 to octal

6510 = 101oct

Sample footer 10

658 8 - 18 1 - 0

Octal to Decimal 1 0 1

= 65

82

81

80 1x 1 =1 +

8x 0 = 0 +

64x 1 = 64 +

Decimal to HexadecimalE.g.: convert decimal number 65 to octal

6510 = 41hex

Sample footer 12

6516 4 - 1

Hexadecimal to Decimal 4 1

= 65

161

160 1x 1 =1

16x 4 = 64 +

Octal to Binary

3 4 5 6

April 27, 2023 Sample footer 14

011

100

101

110

3456 oct = 011100101110b

Hexadecimal to Binary

3 F 7 A

April 27, 2023 Sample footer 15

0011 1111 0100

1010

3F7Ahex = 0011111101001010b

Bits and BytesComputer can understand only On or Off

value as On – 1 Off -0Therefore binary number system is used in

computer system5V (ON)

Sample footer 16

0V (OFF)

Cont…

The word bit is a shortening of the words "Binary digIT”

8 bits = 1 byte 10110011 10111000 11110011 we have 24 bits

that is equal to 3 bytes Eight-bit can represent 256 values (28 values, 0–

255)

Sample footer 17

Cont… When you start talking about lots of bytes, you get

into prefixes like kilo, mega and giga, as in kilobyte, megabyte and gigabyte

April 27, 2023 18

ASCII ASCII - American Standard Code for Information

Interchange American Standard Institute has introduced coding

system to number all characters and numbers by giving it a label between 0 and 255.

Ex: A – 65 , B – 66 To store a character we need to calculate binary

equivalent of ASCII number and send it to computer Ex: A -65 – 01000001

There are other number system as EBCDIC, Extended Binary Coded Decimal Interchange Code adopted by IBM

April 27, 2023 Sample footer 19

Cont… ASCII is fine for the most common English characters,

numbers and punctuation but is a bit limiting for the rest of the world

Therefore Unicode standards are using These days the Unicode standard defines values for

over 100,000 characters

top related