introduction to number representation f451 year 10 computing binary numbers binary numbers...

15
Introduction to Introduction to Number Number Representation Representation F451 Year 10 F451 Year 10 Computing Computing Binary Numbers Binary Numbers Sign/Magnitude Sign/Magnitude 2s Complement 2s Complement

Upload: jeffery-mcdowell

Post on 27-Dec-2015

229 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Introduction to Number Representation F451 Year 10 Computing Binary Numbers Binary Numbers Sign/Magnitude Sign/Magnitude 2s Complement 2s Complement Binary

Introduction to Introduction to Number Number

RepresentationRepresentation

Introduction to Introduction to Number Number

RepresentationRepresentation

F451 Year 10 ComputingF451 Year 10 Computing

Binary NumbersBinary Numbers Sign/MagnitudeSign/Magnitude 2s Complement2s Complement

Binary NumbersBinary Numbers Sign/MagnitudeSign/Magnitude 2s Complement2s Complement

Page 2: Introduction to Number Representation F451 Year 10 Computing Binary Numbers Binary Numbers Sign/Magnitude Sign/Magnitude 2s Complement 2s Complement Binary

BinaryBinaryBinaryBinary

Page 3: Introduction to Number Representation F451 Year 10 Computing Binary Numbers Binary Numbers Sign/Magnitude Sign/Magnitude 2s Complement 2s Complement Binary

BinaryBinaryBinaryBinary

All computer processing is carried out digitally.

This means that the processor handles instructions as binary codes – zeros and ones.

All data on a PC is essentially 0’s and 1’s.

Page 4: Introduction to Number Representation F451 Year 10 Computing Binary Numbers Binary Numbers Sign/Magnitude Sign/Magnitude 2s Complement 2s Complement Binary

Converting binary into positive denary integersConverting binary into positive denary integersConverting binary into positive denary integersConverting binary into positive denary integers

Whole positive denary (base ten) numbers are converted into binary as follows:

135 from denary into binary

128 + 4 + 2 + 1 = 128 + 4 + 2 + 1 = 135135

128128 6464 3232 1616 88 44 22 11

MSBMSBMSBMSB LSBLSBLSBLSB

11 00 00 00 00 11 11 11

Page 5: Introduction to Number Representation F451 Year 10 Computing Binary Numbers Binary Numbers Sign/Magnitude Sign/Magnitude 2s Complement 2s Complement Binary

The repeated division methodThe repeated division methodThe repeated division methodThe repeated division methodA method for converting denary to binary:98 in denary into binary:

98 divide by 2 = 49 remainder 049 divide by 2 = 24 remainder 124 divide by 2 = 12 remainder 012 divide by 2 = 6 remainder 06 divide by 2 = 3 remainder 03 divide by 2 = 1 remainder 11 divide by 2 = 0 remainder 10 divide by 2 = 0 remainder 0

Read the binary code from the remainder from bottom to the top:

01100010 which equals 98

DIVDIV

MODMOD

DIVDIV

MODMOD

Page 6: Introduction to Number Representation F451 Year 10 Computing Binary Numbers Binary Numbers Sign/Magnitude Sign/Magnitude 2s Complement 2s Complement Binary

Binary Coded Decimal (BCD)Binary Coded Decimal (BCD)Binary Coded Decimal (BCD)Binary Coded Decimal (BCD) BCD represents denary integers using blocks of four binary

digits. Each block of four is converted and the denary values are then

read off:

Therefore 1001 0011 10001001 0011 1000 in BCD = 938938 in denary.

88 44 22 11

11 00 00 11

8 + 0 + 0 + 18 + 0 + 0 + 1

99

88 44 22 11

00 00 11 11

0 + 0 + 2 + 10 + 0 + 2 + 1

33

88 44 22 11

11 00 00 00

8 + 0 + 0 + 08 + 0 + 0 + 0

88

Page 7: Introduction to Number Representation F451 Year 10 Computing Binary Numbers Binary Numbers Sign/Magnitude Sign/Magnitude 2s Complement 2s Complement Binary

Uses of BCDUses of BCDUses of BCDUses of BCD

BCD enables fast conversions from denary to binary for applications such as pocket calculators.

Each digit on a calculator corresponds directly to a four-bit block in BCD.

Page 8: Introduction to Number Representation F451 Year 10 Computing Binary Numbers Binary Numbers Sign/Magnitude Sign/Magnitude 2s Complement 2s Complement Binary

Storing Negative IntegersStoring Negative IntegersStoring Negative IntegersStoring Negative Integers

1 method is Sign/Magnitude

6464 3232 1616 88 44 22 11128128+/-+/-

MSBMSBMSBMSB

00 11 00 00 11 00 11 11

75-75

11

1 is a Negative, 0 is a Positive1 is a Negative, 0 is a Positive1 is a Negative, 0 is a Positive1 is a Negative, 0 is a Positive

Page 9: Introduction to Number Representation F451 Year 10 Computing Binary Numbers Binary Numbers Sign/Magnitude Sign/Magnitude 2s Complement 2s Complement Binary

Sign/MagnitudeSign/MagnitudeSign/MagnitudeSign/Magnitude This method has some limitations 2 types of data in the same value (MSB is a sign) Makes calculations difficult by losing 1 bit

6464 3232 1616 88 44 22 11+/-+/-

00 11 00 00 11 00 11 11

127 maximum number127 maximum number127 maximum number127 maximum number

SignSignSignSignValue or MagnitudeValue or MagnitudeValue or MagnitudeValue or Magnitude

Page 10: Introduction to Number Representation F451 Year 10 Computing Binary Numbers Binary Numbers Sign/Magnitude Sign/Magnitude 2s Complement 2s Complement Binary

Storing Negative IntegersStoring Negative IntegersStoring Negative IntegersStoring Negative Integers

Another method is 2s Complement

6464 3232 1616 88 44 22 11128128-128-128

11 00 11 11 00 11 00 11

-75

-128+32+16+4+1=-75

Page 11: Introduction to Number Representation F451 Year 10 Computing Binary Numbers Binary Numbers Sign/Magnitude Sign/Magnitude 2s Complement 2s Complement Binary

2s Complement Conversion2s Complement Conversion2s Complement Conversion2s Complement Conversion -117-117Stage 1 : work out 117 in binaryStage 1 : work out 117 in binary

-128-128 6464 3232 1616 88 44 22 11

11 00 00 00 11 00 11

Stage 2 : Reverse the 0’s and 1’sStage 2 : Reverse the 0’s and 1’s

128128 6464 3232 1616 88 44 22 11

00 11 11 11 00 11 00 11

Stage 3 : Plus 1Stage 3 : Plus 1

1100

Page 12: Introduction to Number Representation F451 Year 10 Computing Binary Numbers Binary Numbers Sign/Magnitude Sign/Magnitude 2s Complement 2s Complement Binary

Representing charactersRepresenting charactersRepresenting charactersRepresenting characters

There are three main coding systems that provide conversions of keyboard characters into binary:

–EBCDIC

–ASCII

–UNICODE

Page 13: Introduction to Number Representation F451 Year 10 Computing Binary Numbers Binary Numbers Sign/Magnitude Sign/Magnitude 2s Complement 2s Complement Binary

EBCDICEBCDICEBCDICEBCDIC

EBCDIC stands for Extended Binary Coded Decimal Interchange Code.

It is an extension of BCD which includes non-numeric characters, including all the keyboard characters and special characters.

It is commonly used to encode data onto magnetic tape.

Page 14: Introduction to Number Representation F451 Year 10 Computing Binary Numbers Binary Numbers Sign/Magnitude Sign/Magnitude 2s Complement 2s Complement Binary

ASCIIASCIIASCIIASCII

ASCII stands for the American Standard Code for Information Interchange.

It has been adopted as the industry-standard way of representing keyboard characters as binary codes.

Every keyboard character is given a corresponding binary code.

ASCII uses an 8-bit code to provide 256 characters.

Page 15: Introduction to Number Representation F451 Year 10 Computing Binary Numbers Binary Numbers Sign/Magnitude Sign/Magnitude 2s Complement 2s Complement Binary

UNICODEUNICODEUNICODEUNICODE

UNICODE is the new standard to emerge that is replacing ASCII.

It has been adopted by many of the big businesses in the computing industry.

It is designed to cover more of the characters that are found in languages across the world.

It has become important due to the increased use of the Internet, as more data is being passed around globally.