Textbook Notes (270,000)

CA (160,000)

York (10,000)

EECS (100)

EECS 1520 (100)

Parke Godfrey (10)

Chapter 3

School

York UniversityDepartment

Electrical Engineering and Computer ScienceCourse Code

EECS 1520Professor

Parke GodfreyChapter

3This

**preview**shows pages 1-3. to view the full**9 pages of the document.**3.1 Data and Computers

Data: basic values or facts

Information: data that is organized to solve problems

Today, computers are “multimedia”, dealing with vast info categories. Helps to modify many

different types of data into Numbers, Text, Audio, Images and Graphics and Video

All data are stored in “binary digits”

Data compression: reducing amount of space to store piece of data

Bandwidth: Number of bits or byes that can be transmitted from one place to another in fixed

amount of time

Compression ratio: size of compressed data / size of original data. Should be between number 0

and 1. Closer to 0, tighter the compression

Lossless Compression: original info is not lost

Lossy compression: some info is lost from compaction

Analog and Digital Data

Computers are finite.

Data can represented in two ways: analog or digital.

Analog: continuous representation, analogous to actual info it represents. Proportional to

continuous, infinite world. Computers cannot work with analog data. Instead we “digitize” data

by breaking into pieces and represent those pieces separately

Digital: discrete representation, breaking info up into separate elements

Why use binary in modern computers? Less expensive and more reliable. Also electronic signals

are far easier to maintain

Digital signals jump sharply between two extremes; behaviour called pulse-code modulation.

Any voltage value above threshold=high value and value below is low value. Digital signal is

“reclocked” to original. As long as it is reclocked before too much degradation, no info is lost.

Binary Representations

To represent 2+, we need multiple bits. 4 combos: 00,01,10 and 11.

If 4+, we need more than two bits. Ex. Three bits can represent 8 things, 4 bits to 16 things, 5 bits

to 32 things…

N bits can be presented as 2^n. every time we increase bits by 1, we DOUBLE

3.2 Representing Numeric Data

National relationship exist between numeric data and binary values

Representing Negative Values

Signed-Magnitude Representation: Number representation in which the sign represents

ordering of the number (- and +) and values represents the magnitude

Problem: there are two representations of zero (+ zero and –zero)

Fixed-Size Numbers

We can represent numbers as integer vales, where half are negative numbers. Sign is determined

by magnitude of number. For ex. If max number of decimal digits is 2, we can let 1 to 49 be

positive number 1 to 49 while 50 to 99 would be negatives values -50 to 1.

For addition, add the numbers together and DISCARD any carry

Only pages 1-3 are available for preview. Some parts have been intentionally blurred.

For negatives: Negative(I) = 10k − I, where k is number of digits

So -3 in two-digit representation would be : −(3) = 102 − 3 = 97

For 3-digit representation: −(3) = 103 − 3 = 997.

Ten’s complement: representation of negative numbers such that negative of I is 10 raised to K

minus I

Since we store everything in modern computer in binary, we use binary equivalent of tens

complement called twos complement

Two’s Complement

To make it easier to look at long binary numbers, we make number line vertical

Ex. −(2) = 27 − 2 = 128 − 2 = −126 ( this is decimal 126, octal 176 and 1111110 in binary)

Leftmost digit shows whether it is positive or negative. 0 is positive and 1 is negative. SO –(2) is

11111110 and negative

Easier way to calculate twos complement: INVERT BITS AND ADD 1. Leftmost bit in negative

number is always 1 so you can tell whether twos complement is negative or positive

Number overflow

Overflow: Occurs when value we compute cannot fit into number of bits we allocated for the

result.

Ex. If each value were stored using eight bits, adding 127 to 3 would produce an overflow.

Representing Real Numbers

Noninteger values=real values. They have whole part and fractional part

The position to right of decimal point would work same way except powers are negative. Ex.

Position to right of decimal point are tenths position (10^-1), the hundredths position (10^-2) and

so on.

In binary, same rule apply except base value is 2. The decimal point is referred to as “radix

point” term used for any base Position to right of radix point in binary are halves position (2^-1)

quarters (2^-2) etc…

How to show real value in computer? We store value as integer and include info of where radix

point is

Real value has 3 properties: sign(+ or -), mantissa (which is made up of digits in value with radix

point assumed to be right) and exponent (determining how radix point is shifted relative to

mantissa.

Example: real value in base 10= _______________________________

Called “floating point” because number of digits is fixed but radix point floats.

When value is floating-point form, positive exponent shift decimal point to right and negative

shifts it to the left.

How to convert real number in decimal notation to floating point notation.

Example: number 148.69 (sign is positive and two digits appear to right)

The exponent is -2 giving us 14869*10^-2.

How to convert floating-point form back to decimal?

Exponent on base tell how many position to move radix point.

If exponent=negative, we move radix point to left

If Positive= we move radix point to the right

Binary floating point value formula=sign*mantissa2^exp

Only pages 1-3 are available for preview. Some parts have been intentionally blurred.

Floating point number in binary on computer we store 3 values that define it For ex. If we devote

64 bits to storage of floating point value, we use 1 bit for sign, 11 bits for exponent and 52 for

mantissa.

How to change fractional part of decimal to binary?

We multiply by new base rather than dividing. Carry from multiplication becomes next digit to

right in answer. Fractional part of result in than multiplied by new base. Process continues until

fractional part is 0.

Lets convert .75 to binary:

.75 * 2 = 1.50

.50 * 2 = 1.00

Therefore, .75 in decimal is .11 in binary

Lets convert 20.25 in decimal to binary

First we have to convert 20.

20 in binary is 10100. Now convert the fractional part

Therefore, 20.25 in decimal lis 10100.01 in binary.

Scientific Notation: form of floating-point in which decimal point is kept right of leftmost digit.

There is one whole number. For example, 12001.32708 are written as 1.200132708E+4 in

scientific notation.

3.3 Representing Text

Document is continuous (analog) entity and separate characters are discrete (digital) elements

that we represent and store in computer memory.

General approach for representing characters is to list all of them and assign binary string to each

character. For example, particular letter, we store appropriate bit string.

Character set: list of characters and codes used to represent each one.

Two kinds: ASCII and UniCode

###### You're Reading a Preview

Unlock to view full version