# Data Representation and Numbers

Views:

Category: Education

## Presentation Description

http://www.teachingcomputing.com GET YOUR COURSES STARTED NOW - plenty of free resources and more Key Points: A creative and engaging introduction to Computer Science  Educators: No prior knowledge of Programming needed to deliver this course  Power Point Based – perfect for presentations or independent own-pace learning  Geared towards GCSE and A Level Course Introduction – leading on to Series 2.  Includes Video tutorials (VB.Net and HTML/JavaScript) + Additional compiled resources and links. Introduction to how Data and numbers can be represented in Computing. Includes the diferent types of Number Systems, like denary, octal, hexadecimal. Representation of Negative numbers including the Sign and Magnitude method and Two's complement.

By: munir86 (108 month(s) ago)

## Presentation Transcript

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

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)

### From the Spec :

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.

### Data needs to be stored in a computer system :

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?

### What is a Computer System? :

What is a Computer System? A series of electrical circuits effectively….

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

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!

?????

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

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

### Slide 8:

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.

### ASCI :

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.

### Number Systems :

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

Binary

### Octal :

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.

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.

### Binary-Coded Decimal (BCD) :

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.

### 1010111100 :

1010111100 001 111 010 100

### Slide 16:

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!

### Slide 17:

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.

### Slide 18:

History of Decimal Writers There follows a chronological list of recorded decimal writers.  Decimal writers c. 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].

### Slide 19:

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

### Slide 20:

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!

### Slide 21:

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..)

### Think of other Number Systems. :

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 as The one to its right. Binary System is great for representing numbers in a computer But very inconvenient for humans to read (even a small number like 256 needs 9 binary digits to represent it) Numbers to base 16 and use the digits -0 to 9 and Letters A to F! 4 16

### Examine the following table. :

Examine the following table. Hexadecimal Numbers Binary Numbers Denary Numbers

### Examine the following table. :

Examine the following table. Hexadecimal Numbers Binary Numbers Denary Numbers

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

Translating from Denary to Binary (RECAP) (Convert 179 to Binary) 128 64 32 16 8 4 2 1 1 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 1 What do you get? *refer to table.. B 3 Hint: 1011 is “11” And 011 is just “3”

### Have a go at translating 10010010 into Hexadecimal! :

Have a go at translating 10010010 into Hexadecimal! 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!

### So what about Negative numbers? :

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 _ _ _ _ _.. This Could be interpreted as -1 mile! 00001 99999 Two’s complement works In the same way!

### How it works…. :

How it works…. 11111101 = -3 11111110 = -2 11111111 = -1 00000000 = 0 00000001 = 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 ___________ 00000000 *Note: the carry of 1 is ignored in this instance.

### Converting a negative denary number to Binary :

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 result Or 1)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

### Converting a two’s complement number into Binary :

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 Or 2)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. 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

### Binary Subtraction :

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 = 11110100 = 00001111 Add = 11110100 _________ 00000011

### Things to remember :

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.

### Question 1 (1 mark) :

Question 1 (1 mark) Binary numbers are ideal for representing Numbers inside a computer but because they are inconvenient for humans to read, Binary numbers are put into groups of 4 bits and displayed in the form of _______________ numbers.

### Question 2 (3 marks) :

Question 2 (3 marks) a) Hexadecimal numbers are numbers to BASE _______ b) They use the digits _________ and c) Letters ___________

### Question 3 (1 mark) :

Question 3 (1 mark) 1 in Denary is ________ in Hexadecimal

### Question 4 :

Question 4 Convert “1 0 0 0 0 1 1 0” to an ordinary Decimal Number! 128 64 32 16 8 4 2 1 0 0 0 0 1 1 0 Answer: 128+4+2=134 Reveal Answer

### Question 5 :

Question 5 Convert “179” to Hexadecimal! B3 (see previous theory slide) Reveal Answer

### Question 6 :

Question 6 Convert “10010010” to Hexadecimal…. Denary=146 and Hex 92! Reveal Answer

### Question 7 :

Question 7 Negative numbers are commonly represented using a system called ___________________ Two’s complement. Reveal Answer

### Question 8 :

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

### Question 9 :

Question 9 Convert the two’s complement number “1001 01 10 “ to denary…. Answer -106 (refer to theory slide)

### Question 10 :

Question 10 Simple Binary Subtraction! Subtract 12 from 15….and show your working! Answer: See theory slide or click

End of Quiz