53
Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent negative numbers -Integer Binary Arithmetic (addition and subtraction) General Overview From the Spec: Unit 3.13 (PART 1)

Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Embed Size (px)

Citation preview

Page 1: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Data: It’s representation, Structure and Management in Information Systems

-Binary-BCD-Octal-Hexadecimal-Two’s Complement & Sign and Magnitude to represent negative numbers-Integer Binary Arithmetic (addition and subtraction)

General Overview

From the Spec: Unit 3.13 (PART 1)

Page 2: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

From the Spec

Number systems

• Data capture, preparation and entry

• Validation and verification of data

• Outputs from a system Candidates should be able to:

express numbers in binary, binary-coded decimal (BCD), octal and hexadecimal; describe and use two’s complement and sign and magnitude to represent negative integers; perform integer binary arithmetic, that is addition and subtraction; explain the use of code to represent a character set (ASCII, EBCDIC and UNICODE); describe manual and automatic methods of gathering and inputting data into a system, including form

design, keyboard entry, voice recognition, barcodes, optical mark recognition (OMR), optical character recognition (OCR), magnetic ink character recognition (MICR), touch screens; image capture, chip and pin, sensors and remote data logging;

explain the techniques of validation and verification, and describe validation tests which can be carried out on data;

describe possible forms of output such as graphs, reports, interactive presentations, sound, video, images, animations, stating the advantages and disadvantages of each with reference to the target audience;

explain the procedures involved in backing up data and archiving, including the difference between data that is backed up and data that is archived.

Page 3: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Data needs to be stored in a computer system

In order for it to be stored it needs to be REPRESENTED in some format.

How can data be understood or represented in a computer system?

Page 4: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

What is a nose?

Page 5: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

What is a computer?

Page 6: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

A computer is a programmable machine that receives input, stores and manipulates data//information, and provides output in a useful format.

Page 7: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

The minimal definition of a computer is anything that transforms information in a purposeful way

Page 8: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent
Page 9: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent
Page 10: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent
Page 11: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

The question is…

Page 12: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Store information?

How does a piece of metalAnd wires and a circuit storeInformation!?!?!?

Page 13: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent
Page 14: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

What is a Computer System?

A series of electrical circuits effectively….

Page 15: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

What sort of language can a computer (loads of circuits, understand?)

The language of on and off.

How can we translate on and off, into something WE understand.

NUMBERS!

Page 16: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

?????

Page 17: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

1’s and 0’s are the only langauge the computer understands.

1 –represents ON 0 –OFF

This system is known as the BINARY system.

Two numbers involved so it is called a BASE 2 system

Page 18: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

The Denary Number system

The number system we have at the moment is referred to as the DENARY NUMBER SYSTEM!

It uses the 10 DIGITS (0 to 9). Base 10 system It is the most widely used

numeral system, perhaps because humans have four

fingers and a thumb on each hand, giving a total of ten digits over both hands.

Page 19: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

ASCI

American Standard Code for Information Interchange (ASCII), pronounced /ˈæski/[1] is a character encoding based on the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that work with text. Most modern character encodings—which support many more characters than did the original—have a historical basis in ASCII.

Historically, ASCII developed from telegraphic codes and its first commercial use was as a seven-bit teleprinter code promoted by Bell data services.

Page 20: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Number Systems

-Binary-Octal-Hexadecimal-Binary Coded Decimal (BCD)

Page 21: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Binary

Page 22: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Octal

The octal (base 8) number system uses a set of eight digits (0 to 7). Octal numbers are organised in ascending powers of 8.

Page 23: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Hexadecimal

The hexadecimal number system (base16) uses a set of sixteen digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F). The letters A to F represent the numbers 10 to 15. Hexadecimal numbers are organised in ascending powers of 16. 

Page 24: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Binary-Coded Decimal (BCD)Binary-coded decimal (BCD) numbering, codes decimal numbers into 4-bit binary numbers. The digits 0 to 9 are represented by the numbers 0000 to 1001.

Page 25: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

1010111100

001 111 010 100

Page 26: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Other Notations

Alternative notations Some cultures do, or used to, use other

numeral systems, including pre-Columbian Mesoamerican cultures such as the Maya, who use a vigesimal system (using all twenty fingers and toes), some Nigerians who use several duodecimal (base 12) systems, the Babylonians, who used sexagesimal (base 60), and the Yuki, who reportedly used octal (base 8).

From wikipedia!

Page 27: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Numerals The ancient  Egyptians were using special symbols, known as

pictographs, to write down numbers over 3,000 years ago. Later, the Romans developed a system of numerals that used letters from their alphabet rather than special symbols. Today, we use numbers based on the Hindu-Arabic system. We can write down any number using combinations of up to 10 different symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9). The ancient Egyptians developed number systems to keep accounts of what was bought and sold.

What is a Number? We use numbers every day and tend to take them for granted. But

how did the idea of numbers arise? Did every culture develop the ideas of counting and numbers separately or have these ideas arisen in only a few cultures and then spread, for example, through trade? Is counting intuitive or did it arise to solve particular problems?Some of the oldest evidence of counting so far discovered comes from ancient artifacts belonging to groups of hunters and gatherers. For example, a wolf bone, dated about 30,000 BC, has been discovered with a series of notches carved in it, which seem to represent a tally of some kind.

Page 28: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

History of Decimal Writers

There follows a chronological list of recorded decimal writers.[edit] Decimal writersc. 3500 - 2500 BC Elamites of Iran possibly used early forms of decimal system. [2] [3] c. 2900 BC Egyptian hieroglyphs show counting in powers of 10 (1 million + 400,000 goats, etc.) – see Ifrah, below c. 2600 BC Indus Valley Civilization, earliest known physical use of decimal fractions in ancient weight system: 1/20, 1/10, 1/5,

1/2. See Ancient Indus Valley weights and measures c. 1400 BC Chinese writers show familiarity with the concept: for example, 547 is written 'Five hundred plus four decades plus

seven of days' in some manuscripts c. 1200 BC In ancient India, the Vedic text Yajur-Veda states the powers of 10, up to 1055 c. 400 BC Pingala – develops the binary number system for Sanskrit prosody, with a clear mapping to the base-10 decimal

system c. 250 BC Archimedes writes the Sand Reckoner, which takes decimal calculation up to 1080,000,000,000,000,000 c. 100–200 The Satkhandagama written in India – earliest use of decimal logarithms c. 476–550 Aryabhata – uses an alphabetic cipher system for numbers that used zero c. 598–670 Brahmagupta – explains the Hindu-Arabic numerals (modern number system) which uses decimal integers,

negative integers, and zero c. 780–850 Muḥammad ibn Mūsā al-Ḵwārizmī – first to expound on algorism outside India c. 920–980 Abu'l Hasan Ahmad ibn Ibrahim Al-Uqlidisi – earliest known direct mathematical treatment of decimal fractions. c. 1300–1500 The Kerala School in South India – decimal floating point numbers 1548/49–1620 Simon Stevin – author of De Thiende ('the tenth') 1561–1613 Bartholemaeus Pitiscus – (possibly) decimal point notation. 1550–1617 John Napier – use of decimal logarithms as a computational tool 1765 Johann Heinrich Lambert – discusses (with few if any proofs) patterns in decimal expansions of rational numbers and

notes a connection with Fermat's little theorem in the case of prime denominators 1800 Karl Friedrich Gauss – uses number theory to systematically explain patterns in recurring decimal expansions of rational

numbers (e.g., the relation between period length of the recurring part and the denominator, which fractions with the same denominator have recurring decimal parts which are shifts of each other, like 1/7 and 2/7) and also poses questions which remain open to this day (e.g., a special case of Artin's conjecture on primitive roots: is 10 a generator modulo p for infinitely many primes p?).

1925 Louis Charles Karpinski – The History of Arithmetic [1] 1959 Werner Buchholz – Fingers or Fists? (The Choice of Decimal or Binary representation)[2] 1974 Hermann Schmid – Decimal Computation[3] 2000 Georges Ifrah – The Universal History of Numbers: From Prehistory to the Invention of the Computer[4] 2003 Mike Cowlishaw – Decimal Floating-Point: Algorism for Computers[5].

Page 29: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

What you need to understand is how it works…..

In the denary number system as you move from RIGHT TO LEFT…each digit is worth _______ times as much as its right-hand neighbour.

Take the example of the number 673

Page 30: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

673 –what does it represent?

6 * 100+7*10+3*1 673

units

tens

hundreds

Another way of putting this is to say that…..

THE DENARY SYSTEM IS A BASE 10 SYSTEM!

Page 31: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

http://www.youtube.com/watch?v=Q35m19c6O0c(ancient egyptians used the Binary base 2 system)

http://www.youtube.com/watch?v=2TsngUGxHJw (modern explanation by boy wearing a hoodie)

http://www.youtube.com/watch?v=ET42fdKeHI8&feature=related

(How computers and binary actually work)

http://www.youtube.com/watch?v=PaJB5SGbAKU (What is the relationship between existence and numbers? Or numbers and language..)

Page 32: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Think of other Number Systems.

-Binary System

-Hexadecimal Systems

Base __ System, using only the digits __ and __. This means that each digit is worth ______

as much as the one to its right.

Binary Numbers can be put into groups of ____ bits and displayed in the form of Hexadecimal numbers. These are numbers to Base __

Answer: Base 2 System. Using 1 and 0. Each digit worth TWICE as much asThe one to its right. Binary System is great for representing numbers in a computerBut very inconvenient for humans to read (even a small number like 256 needs9 binary digits to represent it)

Numbers to base 16 and use the digits-0 to 9 and

Letters A to F!

4

16

Page 33: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Examine the following table.

1 1 1

2 10 2

3 11 3

4 100 4

5 101 5

6 110 6

7 111 7

8 1000 8

9 1001 9

10 1010 A

11 1011 B

12 1100 C

13 1101 D

14 1110 E

15 1111 F

16 10000 10

Hexadecimal Numbers

Binary Numbers

Denary Numbers

Page 34: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Examine the following table.

1 1 1

2 10 2

3 11 3

4 100 4

5 101 5

6 110 6

7 111 7

8 1000 8

9 1001 9

10 1010 A

11 1011 B

12 1100 C

13 1101 D

14 1110 E

15 1111 F

16 10000 10

Hexadecimal Numbers

Binary Numbers

Denary Numbers

Page 35: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Translating from Denary to Binary (RECAP) (Convert 179 to Binary)

128 64 32 16 8 4 2 11 0 1 1 0 0 1 1

Next, how do we convert 179 into HEXADECIMAL?

The easiest way is to convert the number into BINARY (as we’ve already done!)

You then translate each group of 4 DIGITS into hexadecimal….

1 0 1 1 0 0 1 1What do you get? *refer

to table..

B 3Hint: 1011 is “11”

And 011 is just “3”

Page 36: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Have a go at translating 10010010 into Hexadecimal!

128 64 32 16 8 4 2 1

Click for Answer

1 0 0 1 0 0 1 0

128 + 16 + 2 =146

1001 =9 and 0010 =2

Therefore in HEX the number would be 92!

Page 37: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

So what about Negative numbers?

- Numbers are usually represented using a system called TWO’s COMPLEMENT.

Think of the Mileometer of a car set to 00000 miles. If the car goes forward one mile the

reading becomes _ _ _ _ _.

If the meter was turned back one mile the reading becomes _ _ _ _ _.. ThisCould be interpreted as -1 mile!

00001

99999Two’s complement works In the same way!

Page 38: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

How it works….

11111101 = -311111110 = -211111111 = -1 00000000 = 000000001 = 1 and so on….

Notice that if the number starts with a 1, it represents a negative number.

If you were to add together the binary equivalents of 3 and -3 what would

you get?

11111101+ 00000011___________(1) 00000000

*Note: the carry of 1 is ignored in this instance.

Page 39: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Converting a negative denary number to Binary

1)Find the Binary value of the equivalent positive decimal number

2)Change all the 0’s to 1’s and all the 1’s to 0’s

3)Add 1 to the resultOr1)Starting from the right, leave all the digits

alone up to and including the first ‘1’2)Change all the other digits from 0 to 1 or

from 1 to 0

RULES

Example: 00110100 = 11001100

EASIER

Page 40: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Converting a two’s complement number into Binary

You can do one of two things

1)Flip the bits, add 1, then work out the positive equivalent Or2)Use the place values. (Write the binary digits down under the

headings 1,2,4,8 noting that the leftmost bit has a negative place value. Add up all the headings which have a 1 under them.

128 64 32 16 8 4 2 1

1 0 0 1 0 1 1 0

This equals -128+16+4+2 = (It’ll be a minus number)

-106

Page 41: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Binary Subtraction

1)First convert the number to be subtracted into a negative number

2)then….add it!

So, to subtract 12 from 15….using 1 byte for each number.

12 = 00001100 (in binary)-12 = 1111010015 = 00001111Add = 11110100

_________ 00000011

Page 42: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Things to remember

A positive number always has 0 as the MSB

A negative number always has 1 as the MSB

An even number always has 0 as the LSB

An odd number always has 1 as the LSB -1 is always represented by a 1 in every

bit, whatever the word size.

Page 43: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Question 1 (1 mark)

Binary numbers are ideal for representingNumbers inside a computer but becausethey are inconvenient for humans to read, Binary numbers are put into groups of4 bits and displayed in the form of_______________ numbers.

Page 44: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Question 2 (3 marks)

a) Hexadecimal numbers are numbers to BASE _______

b) They use the digits _________ and

c) Letters ___________

Page 45: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Question 3 (1 mark)

1 in Denary is ________ in Hexadecimal

Page 46: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Question 4

Convert

“1 0 0 0 0 1 1 0”

to an ordinary Decimal Number!

128 64 32 16 8 4 2 11 0 0 0 0 1 1 0

Answer: 128+4+2=134

Reveal Answer

Page 47: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Question 5

Convert

“179”

to Hexadecimal!

B3 (see previous theory slide)

Reveal Answer

Page 48: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Question 6

Convert

“10010010”

to Hexadecimal….

Denary=146 and Hex 92!

Reveal Answer

Page 49: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Question 7

Negative numbers are commonly represented using a system called ___________________

Two’s complement.

Reveal Answer

Page 50: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Question 8

What would -1 be in Binary ? (hint: You know that 0 would be 00000000)

Answer: 11111111

Page 51: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Question 9

Convert the two’s complement number

“1001 01 10 “ to denary….

Answer -106 (refer to theory slide)

Page 52: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

Question 10

Simple Binary Subtraction!

Subtract 12 from 15….and show your working!

Answer: See theory slide or click

Page 53: Data: It’s representation, Structure and Management in Information Systems -Binary -BCD -Octal -Hexadecimal -Two’s Complement & Sign and Magnitude to represent

End of Quiz