Top Banner
12

Representation of Positive Numbers

May 16, 2015

Download

Education

Higher Computing – Data Representation – Representation of Positive Numbers
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Representation of Positive Numbers
Page 2: Representation of Positive Numbers

Decimal NumbersIn every day life we use 10 decimal numbers to represent numerical data

0 1 2 3 4 5 6 7 8 9

The number 42678 can be read as

ten thousands104

thousands103

hundreds102

tens101

units100

4 2 6 7 8

The number that forms the basis of any system is called the base.

So the decimal number system is called base 10.

Page 3: Representation of Positive Numbers

The Binary Number SystemThe lowest number base that can be used to represent numbers is base 2.

Using only two numbers to represent what happens inside a computer is called the binary system.

on = 1 bitoff = 0 bit

Page 4: Representation of Positive Numbers

Why design computers as 2 state devices?

1. Simplicity in only having to generate and detect two voltage levels.

2. Good tolerance, because a degraded positive voltage (1 bit) is still recognisable as a positive voltage

Page 5: Representation of Positive Numbers

Why design computers as 2 state devices?3. Calculations are kept simple.

There are four rules for addition / subtraction / multiplication / division in the binary number system.

There are one hundred rules for addition / subtraction / multiplication / division in the decimal number system.

Page 6: Representation of Positive Numbers

Why design computers as 2 state devices?

4. Magnetic and optical media are suited to two state systems.

Page 7: Representation of Positive Numbers

Binary NumbersWe have seen that the number 42678 can be represented as:

104 103 102 101 100

4 2 6 7 8

Binary (base 2) works in a similar way. The binary number 1 1 0 0 1 can be represented as:

24 23 22 21 20

1 1 0 1 1

Or

16 8 4 2 11 1 0 1 1

Page 8: Representation of Positive Numbers

Converting Binary Numbers to Decimal

The binary number 1 1 0 0 1

16 8 4 2 11 1 0 0 1

= (1 * 16) + (1 * 8) + (0 * 4) + (0 * 2) + (1 * 1)

= 16 + 8 + 0 + 0 + 1

= 25

Page 9: Representation of Positive Numbers

Converting a Byte to DecimalThe term bit is short for binary digit

A byte is made up of 8 bits

The byte 1 0 1 0 1 1 0 1 can be converted to decimal as:

16 8 4 2 11 0 1 0 1 1 0 1

= (1 * 128) + (1 * 32) + (1 * 8) + (1 * 4) + (1 * 1)

= 128 + 32 + 8 + 4 + 1

= 173

3264128

Page 10: Representation of Positive Numbers

Converting Decimal Numbers to BinaryExample: Convert 86 to binary

1280

Next 64. Does 64 go into 86? Yes.

128 640 1

Subtract the 64 from 86, leaving 22. Next 32. Does 32 go into the remaining 22? No

128 64 320 1 0

Start with 128. Does 128 go into 86? No.

Page 11: Representation of Positive Numbers

128 64 32 160 1 0 1

Next 16. Does 16 go into 22? Yes.

Converting Decimal Numbers to Binary

Subtract the 16 from 22, leaving 6. Next 8. Does 8 go into the remaining 6? No

128 64 32 16 80 1 0 1 0

Next 4. Does 4 go into the remaining 6? YesSubtract 4 from 6, leaving 2.Next 2. Does 2 go into the remaining 2? YesSubtract 2 from 2, leaving 0.Finally 1. Does 1 go into the remaining 0? No128 64 32 16 8 4 2 10 1 0 1 0 1 1 0

Page 12: Representation of Positive Numbers

CreditsHigher Computing – Data Representation – Representation of Positive Numbers

Produced by P. Greene and adapted by R. G. Simpson for the City of Edinburgh Council 2004

Adapted by M. Cunningham 2010

All images licenced under Creative Commons 3.0•Hard Disk B by Christian Jansky•CD-ROM by Vincent1969•Voltometer by Brandi Sims•Numbers by Procsilas Moscas