Presentation is loading. Please wait.

Presentation is loading. Please wait.

Binary Fractions.

Similar presentations


Presentation on theme: "Binary Fractions."— Presentation transcript:

1 Binary Fractions

2 Fractions A radix separates the integer part from the fraction part of a number. Columns to the right of the radix have negative powers of 2.

3 Fractions 22 21 20 . 2-1 2-2 2-3

4 Fractions 22 21 20 . 2-1 2-2 2-3 4 2 1

5 Fractions 22 21 20 . 2-1 2-2 2-3 4 2 1

6 Fractions 22 21 20 . 2-1 2-2 2-3 4 2 1 +

7 Fractions 22 21 20 . 2-1 2-2 2-3 4 2 1 + 5⅝

8 Fractions Another way to assess the fraction: ½ ¼ ⅛ Just as this is 5

9 Fractions Another way to assess the fraction: ½ ¼ ⅛ Just as this is 5 so is this!

10 Fractions Another way to assess the fraction: ½ ¼ ⅛ Just as this is so is this Except it’s not 5 ones. It’s 5 eighths.

11 Fractions Another way to assess the fraction: ½ ¼ ⅛ Just as this is so is this Except it’s not 5 ones. It’s 5 eighths.

12 Fractions But there’s no dot (.) in Binary!
We need to explore a method for storing fractions without inventing another symbol.

13 Scientific Notation a × 10b 1 ≤ |a| < 10
Very large and very small numbers are often represented such that their orders of magnitude can be compared. The basic concept is an exponential notation using powers of 10. a × 10b Where b is an integer, and a is a real number such that: 1 ≤ |a| < 10

14 Scientific Notation - examples
An electron's mass is about  kg. In scientific notation, this is written: ×10−31 kg.

15 Scientific Notation - examples
An electron's mass is about  kg. In scientific notation, this is written: ×10−31 kg.

16 Scientific Notation - examples
The Earth's mass is about 5,973,600,000,000,000,000,000,000 kg. In scientific notation, this is written: 5.9736×1024 kg.

17 Scientific Notation - examples
The Earth's mass is about 5,973,600,000,000,000,000,000,000 kg. In scientific notation, this is written: 5.9736×1024 kg.

18 E Notation To allow values like this to be expressed on calculators and early terminals ‘× 10b’ was replaced by ‘Eb’ So ×10−31 becomes E−31 And ×1024 becomes E+24

19 E Notation The ‘a’ part of the number is called the mantissa or significand. The ‘Eb’ part is called the exponent. Since exponents could also be negative, they would typically have a sign as well.

20 Floating Point Storage
In floating point notation the bit pattern is divided into 3 components: Sign – 1 bit (0 for +, 1 for -) Exponent – stored in Excess notation Mantissa – must begin with 1

21 Floating Point Storage
In floating point notation the bit pattern is divided into 3 components: Sign – 1 bit (0 for +, 1 for -) Exponent – stored in Excess notation Mantissa – must begin with 1

22 Floating Point Storage
In floating point notation the bit pattern is divided into 3 components: Sign – 1 bit (0 for +, 1 for -) Exponent – stored in Excess notation Mantissa – must begin with 1

23 Floating Point Storage
In floating point notation the bit pattern is divided into 3 components: Sign – 1 bit (0 for +, 1 for -) Exponent – stored in Excess notation Mantissa – must begin with 1

24 Mantissa Assumes a radix point immediately left of the first digit.
The exponent will determine how far, and in which direction to move the radix.

25 An example in 8 bits If the following pattern stores a floating point value, what is it?

26 An example in 8 bits If the following pattern stores a floating point value, what is it? Separate it into its components:

27 An example in 8 bits If the following pattern stores a floating point value, what is it? Separate it into its components: sign exponent mantissa

28 An example in 8 bits If the following pattern stores a floating point value, what is it? Separate it into its components: sign exponent mantissa

29 An example in 8 bits A sign bit of 0 means the number is…?

30 An example in 8 bits A sign bit of 0 means the number is positive. 110 in Excess Notation converts to …?

31 An example in 8 bits A sign bit of 0 means the number is positive. 110 in Excess Notation converts to +2. Place the radix in the mantissa …

32 An example in 8 bits A sign bit of 0 means the number is positive. 110 in Excess Notation converts to +2. Place the radix in the mantissa .1001 Put it all together …

33 An example in 8 bits A sign bit of 0 means the number is positive. 110 in Excess Notation converts to +2. Place the radix in the mantissa .1001 Put it all together … * 22

34 An example in 8 bits + .1001 * 22 9/16 * 4 = 36/16 9/16 * 4 = 9/4
As we’ve seen: * 22 the mantissa can be understood as 9, in the sixteenths column. Of course, 22 is 4, so we need to solve 9/16 * 4. 9/16 * 4 = 36/16 9/16 * 4 = 9/4 = 2 4/16 = 2 1/4

35 Alternatively * 22 Multiplying a binary number by 2 shifts the bits left (moves the radix to the right) one position. So the exponent +2 tells us to shift the radix 2 positions right. = 2¼

36 Normal Form The rule of Normal Form guarantees a unique mapping of patterns onto values.

37 Normal Form Consider the following 8-bit pattern in Normal Form:
.1000 1 .0100 2 .0010 3 .0001

38 Normal Form The exponent represents 0 so the radix is moved 0 positions. .1000 1 .0100 2 .0010 3 .0001

39 Normal Form The exponent represents 0 so the radix is moved 0 positions. .1000 1 .0100 2 .0010 3 .0001

40 Normal Form Now consider this pattern, which is NOT in Normal Form.
.1000 1 .0100 2 .0010 3 .0001

41 Normal Form The exponent represents +1 so the radix is moved 1 position to the right. .1000 1 .0100 2 .0010 3 .0001

42 Normal Form The exponent represents +1 so the radix is moved 1 position to the right. .1000 1 .0100 2 .0010 3 .0001

43 Normal Form But this is the same result as the first example!
.1000 1 .0100 2 .0010 3 .0001

44 Normal Form In fact there are MANY possible ways to represent the same value: .1000 1 .0100 2 .0010 3 .0001

45 Normal Form The first bit of the mantissa must be 1 to prevent multiple representations of the same value. .1000 1 .0100 2 .0010 3 .0001


Download ppt "Binary Fractions."

Similar presentations


Ads by Google