Download presentation

Presentation is loading. Please wait.

1
Binary Negative Integers

2
**Negative Integers Sign and magnitude One’s complement Two’s complement**

Binary Coded Decimal (BCD)

3
Sign and Magnitude The method used in decimal to represent negative numbers is sign and magnitude. - 25 Sign Magnitude/value This system is available in decimal where: 1 ≡ negative sign

4
**Sign and Magnitude The method is as follows:**

Convert the value or magnitude to binary and represent using eight or ten bits or as you are instructed Change the leftmost bit to 1 if the number is negative

5
Example: Represent the following decimal as binary, using sign and magnitude: NEGATIVE 1010 NEGATIVE 2510

6
**-10 to Binary using 8 bit Sign and Magnitude**

Convert 10 to binary 1010 Use 8 bits to represent Change to negative: -1010= 2 10 Remainder 5 1

7
**-25 to Binary using 8 bit Sign and Magnitude**

Convert 25 to binary 11001 Use 8 bits to represent Change to negative: -2510= 2 25 Remainder 12 1 6 3

8
**One’s Complement The method is as follows:**

Convert the value or magnitude to binary and represent using eight or ten bits or as you are instructed Find the complement by changing all the 0’s to 1’s and all the 1’s to 0’s

9
Example: Represent the following decimal as binary, using ONE’S COMPLEMENT: NEGATIVE 1010 NEGATIVE 2510

10
**-25 to Binary using 8 bit One’s Complement**

Convert 25 to binary 11001 Use 8 bits to represent Change to negative: 1 0 and; 0 1 -2510= 2 25 Remainder 12 1 6 3

11
**Two’s Complement The method is as follows:**

Convert the value or magnitude to binary and represent using eight or ten bits or as you are instructed Find the One’s complement by changing all the 0’s to 1’s and all the 1’s to 0’s Add one to the new value

12
Example: Represent the following decimal as binary, using TWO’S COMPLEMENT: NEGATIVE 1010 NEGATIVE 2510

13
**-25 to Binary using 8 bit Two’s Complement**

Convert 25 to binary 11001 Use 8 bits to represent Find one’s complement Add one to the answer -2510= 2 25 Remainder 12 1 6 3 1 +

14
Binary Coded Decimal B.C.D.

15
**Format Each digit is converted separately using four (4) bits each. 25**

Remainder 1 2= 0010 25 2 5 Remainder 1 5=0101 0010 0101

16
Format Decimal positioning is kept 25 = 0010 0101 2 10

17
**Negative BCD Use Sign and Magnitude where the signs are:**

+ Positive = 1110 2 - Negative = 1111 2

18
Positive and Negative +25 = 0101 2 -25 = 0101 2

19
**Convert the following numbers from decimal to binary using BCD format:**

Steps: Convert each digit to binary Write sign (if necessary) Write answer in decimal order Convert the following numbers from decimal to binary using BCD format:

20
Binary Real Numbers

21
**Real Numbers Real numbers are numbers containing fractions.**

There are two ways real numbers are represented in binary. They are: Fixed-point numbers Floating-point numbers

22
Fixed-point Numbers Decide the number of places after the point because the point is not stored among the digits. Convert the whole number to binary Convert the fraction to binary: Multiply the fraction by two and record the any resulting whole number Repeat until you get the set amount of places after the point

23
Fixed-point Numbers Convert to binary with 4 places after the point. The answer is therefore: 2 4 R 1 =100 0.2 x 2 = 0.4 0.4 x 2 0.8 0.8 x 2 1.6 0.6 x 2 1.2 =0011

24
**Floating-point Numbers**

The number of places after the point varies. Data is represented in the following parts: A sign A fractional part (example 0.345) or mantissa The base An exponent

25
Standard Form Change to standard form: 345 -45.6

26
**Floating-point Numbers**

Decimal Example: This is equal to writing a number in standard form 3 345 = x 10 Exponent Sign Mantissa base 2 -45.6 = x 10

27
**Floating-point Numbers**

Binary Example: Binary number The mantissa is a binary fraction The sign bit : 1 for negative and 0 for positive This exponent uses sign and magnitude 1 111 1010 Sign Exponent Mantissa

28
**Floating-point Numbers**

IEEE Standard uses 32 and 64bits, but for simplicity we will use only 8 bits as follows: The sign – 1 bit 1 means negative; 0 means positive The Exponent – 3 bits Sign and magnitude. Leftmost bit is the sign The Mantissa – 4 bits A fraction

29
From Decimal: 3¾ Convert the decimal to binary (maintain the whole and fraction parts). Normalise the mantissa Convert the resulting exponent Insert the sign bit Write the number in SEM format 3 ¾ to binary retaining decimal format: 11.11 Normalised mantissa as if in standard form: .1111x22 The exponent : 2 = 011 The number is positive, so the sign = 0 RESULT:

30
**Let us Calculate: Binary Example: 111110102 The mantissa : 0.625**

The sign bit : - (negative) The exponent : -3 RESULT: X 2-3 2-1 2-2 2-3 2-4 1 .5 0.125 1 111 1010 Sign Exponent Mantissa - -3 0.625 =

31
**Let us Calculate: Binary Example: 111110102 The mantissa is: 0.625**

The sign bit : - (negative) The exponent : -3 RESULT: X 2-3 = = =

32
**Characters ASCII (American Standard Code of Information Interchange)**

EBCDIC (Extended Binary Coded Decimal Interchange Code

33
Parity Bit To maintain data integrity a special signal bit is sometimes used. This is a parity bit. Instead of the regular eight bits that make up the byte, nine bits are used. If he number of “1” bits is odd then the parity is set to 1 so that the number of 1”s is always even If the number of “1” bits is even the parity is set to “0”.

34
The END

Similar presentations

Presentation is loading. Please wait....

OK

Lecture 8 Floating point format

Lecture 8 Floating point format

© 2018 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google