Google Website Translator

Monday, April 4, 2011

Tugas 1 Struktur Data ( TIPE DATA)

© SKEMA SIGN AND MAGNITUDE

This method is a conventional form used by humans to express a number in binary form. Here the representation of positive and negative numbers are distinguished only by the sign alone. Usually positive or negative sign indicated by the leading digits of the binary form, to representation by a certain number of digits.  Example:

          
+5 ® + ® 101 or 5 101 (in binary)

          
-5 ® - 101
Note: sign (+) are usually ignored

© SKEMA TWO’S COMPLEMENT

 If x is non-negative integers then x 'negative binary number of x such that x + x' = R

                               
R = 2 (pangkat) N

                               
N = maximum number of digits

                               
x '= R - x

 
Answers Duties:
When N = 3, then R = 2 (pangkat) 3 = 8

        
x = 5 ® 101

        
x '= R - x

           
= 8-5 = 3 ® 11 (in binary) .............(- 3)

 

© SKEMA ONE’S COMPLEMENT

 If x is non-negative integers then x 'negative binary number of x such that x + x' = R

                               
R = 2 (pangkat) N - 1

                               
N = maximum number of digits

                               
x '= R - x

 
Answers Duties:
When N = 3, then R = 2 (pangkat) 3-1 = 7

        
x = 5 ® 101

        
x '= R - x

           
= 7-5 = 2 ® 10 .............. (-2)
Notes
For R = 2 (rank) N and R = 2 (pangkat) N - 1, integers that can be kept in storage for the 2nd way is:
 2
(pangkat) (N-1) - 1
For R = 2 (pangkat) 3, the largest integer = 2 (pangkat) 2 -1, then r = 3 represents a number from -3 to +3


1. SCHEME TWO's complement
 

X = -3 ............... X '= 8-3 = 5 .......... X' = 101 (in binary)  
X = -2 ................ X '= 8-2 = 6 .......... X' = 110
X = -1 ................. X '= 8-1 = 7 ......... X' = 111
 

2. ONE SCHEME's complement
 

X = -3 ............... X '= 7-3 = 4 .......... X' = 100 (in binary)  
X = -2 ................ X '= 7-2 = 5 .......... X' = 101  
X = -1 ................. X '= 7-1 = 6 ......... X' = 110




INTEGER
SIGN &
MAGNITUDE
TWO’S
COMPLEMENT
ONE’S
COMPLEMENT
-3
-11
101
100
-2
-10
110
101
-1
-01
111
110
0
00
000
000
1
01
001
001
2
10
010
010
3
11
011
011


Hopefully useful..........

Powered by Blogger.
Twitter Delicious Facebook Digg Stumbleupon Favorites More