fixed point binary numbers. objectives draw a distinction between integers and numbers with a...

7
Fixed point binary numbers

Upload: lucas-lambert

Post on 26-Dec-2015

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Fixed point binary numbers. Objectives  Draw a distinction between integers and numbers with a fractional part in a computer context.  Describe how

Fixed point binary numbers

Page 2: Fixed point binary numbers. Objectives  Draw a distinction between integers and numbers with a fractional part in a computer context.  Describe how

ObjectivesDraw a distinction between integers and

numbers with a fractional part in a computer context.

Describe how an unsigned denary number with a fractional part is represented in fixed-point form in binary.

Page 3: Fixed point binary numbers. Objectives  Draw a distinction between integers and numbers with a fractional part in a computer context.  Describe how

Numbers A whole number is called an integer Integers are great because they can easily be

converted to binary

But… it’s generally accepted at some stage fractional numbers will occur

For example 7 divide by 3 will equal 2.333

This becomes more of a challenge

Page 4: Fixed point binary numbers. Objectives  Draw a distinction between integers and numbers with a fractional part in a computer context.  Describe how

Negative numbers!!

Once again we use the magic numbers but this time we are going to add a decimal place and some fractions.

The other side of the decimal place we have to use fractions and half each time

Lets have a go at converting 68.25

First step is to do the whole number conversion

Then do the fraction side.

128 64 32 16 8 4 2 1 . 1/2 1/4 1/8 1/16

0 1 0 0 0 1 0 0 . 0 1 0 0

NOTEYou will only

ever be asked

to convert up to

4 decimal place

Page 5: Fixed point binary numbers. Objectives  Draw a distinction between integers and numbers with a fractional part in a computer context.  Describe how

Fraction ConversionSo it’s fairly standard thing to know that

½ = 0.5 ¼ = 0.25 But a little more difficult after that

Binary fraction

Fraction Decimal Fraction

0.1 1/2 0.5

0.01 1/4 0.25

0.001 1/8 0.125

0.0001 1/16 0.0625

0.00001 1/32 0.03125

Page 6: Fixed point binary numbers. Objectives  Draw a distinction between integers and numbers with a fractional part in a computer context.  Describe how

Fixed point binary numbersThere are other ways of representing fractional

numbers but you don’t need to know about these yet!

The advantage of fixed point is that it is exactly the same as integer arithmetic, making processing faster

The disadvantage is that it has limited range

Page 7: Fixed point binary numbers. Objectives  Draw a distinction between integers and numbers with a fractional part in a computer context.  Describe how

Time to tryConvert the following to fixed point binary

2.75

3.625

13.375

26.1875

23.5625

6.875

21.3125

Convert the following, assuming 4 bits after the point:

01011000

0110010

11001100

11110110

11010100