Data Representation
Data Representation
0 0 0 0 0 0 0 0 which equals to 0
➢ The largest binary number would be …
1 1 1 1 1 1 1 1 which equals ….
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255 =
8
2 -1
Therefore the range is 0 - 255 (256 numbers)
Signed Numbers
Signed Numbers
◼ Until now we've been concentrating on unsigned
numbers. In real life we also need to be able
represent signed numbers ( like: -12, -45, +78).
◼ A signed number MUST have a sign (+/-). A method
is needed to represent the sign as part of the binary
representation.
◼ Two signed number representation methods are:
◼ Sign/magnitude representation
◼ Ones-complement representation
◼ Twos-complement representation
Sign/Magnitude
Representation
◼ 0 for positive,
◼ 1 for negative;
Ex 1.
18 .625
- 16 - .5
2 .125
- 2 - .125
0 0
18.62510 = 10010.1012
Problem storing binary form
1 2 9 10 32
IEEE Floating Point Representation
2-10
28
(Answers on next slide)
Answers
2-10
exponent -10 8-bit
bias +127 value
117 → 01110101
28
exponent 8 8-bit
bias +127 value
135 → 10000111
IEEE Floating Point Representation
◼ The mantissa is the set of 0’s and 1’s to
the right of the radix point of the
normalized (when the digit to the left of the
radix point is 1) binary number.
Ex: 1.00101 X 23
(The mantissa is 00101)
Step 1.
Compute the binary equivalent of the
whole part and the fractional part. (i.e.
convert 40 and .15625 to their binary
equivalents)
Decimal Floating Point to
IEEE standard Conversion
40 .15625
- 32 Result: -.12500 Result:
8 101000 .03125 .00101
- 8 -.03125
0 .0
101000.00101 = 1.0100000101 x 25
Decimal Floating Point to
IEEE standard Conversion
127 + 5 = 132
13210 = 100001002
Decimal Floating Point to
IEEE standard Conversion
0 10000100 01000001010000000000000
Decimal Floating Point to
IEEE standard Conversion
Ex 2: Find the IEEE FP representation of –24.75
Step 1. Compute the binary equivalent of the whole
part and the fractional part.
24 .75
- 16 Result: - .50 Result:
8 11000 .25 .11
- 8 - .25
0 .0
So: -24.7510 = -11000.112
Decimal Floating Point to
IEEE standard Conversion
Step 2.
Normalize the number by moving the decimal
point to the right of the leftmost one.
-11000.11 = -1.100011 x 24
Decimal Floating Point to
IEEE standard Conversion.
1 01111101 010..0
IEEE standard to Decimal
Floating Point Conversion..
= -0.312510
IEEE standard to Decimal
Floating Point Conversion.
Exponent
1 . ____________
Mantissa x 2 ----
= 25.510
000 001 010 011 100 101 110 111
0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL