Académique Documents
Professionnel Documents
Culture Documents
Ray Seyfarth
c
2011
Ray Seyfarth
Outline
Binary numbers
Hexadecimal numbers
Integers
c
2011
Ray Seyfarth
Binary numbers
Decimal place value system
10101111 = 27 + 25 + 23 + 22 + 2 + 1
= 128 + 32 + 8 + 4 + 2 + 1
= 175
64 Bit Intel Assembly Language
c
2011
Ray Seyfarth
Bit numbering
bit value
bit position
1
7
0
6
1
5
0
4
1
3
1
2
1
1
1
0
c
2011
Ray Seyfarth
370
185
92
46
23
11
5
2
1
0
remainder
1
0
1
0
0
1
1
1
0
1
bits
1
01
101
0101
00101
100101
1100101
11100101
011100101
1011100101
c
2011
Ray Seyfarth
Hexadecimal numbers
Base 16 numbers
Use as digits 0-9 and A-F (or a-f)
A=10, B=11, C=12, D=13, E=14, F=15
0x2b1a = 2 163 + 11 162 + 1 16 + 10
= 2 4096 + 11 256 + 16 + 10
= 8192 + 2816 + 16 + 10
= 11034
c
2011
Ray Seyfarth
c
2011
Ray Seyfarth
2500
156
9
0
remainder
7
4
12
9
hex
7
47
c47
9c47
c
2011
Ray Seyfarth
Integers
Bits
8
8
16
16
32
32
64
64
Bytes
1
1
2
2
4
4
8
8
Minimum
0
-128
0
-32768
0
-2147483648
0
-9223372036854775808
Maximum
255
127
65535
32767
4294967295
2147483647
18446744073709551615
9223372036854775807
c
2011
Ray Seyfarth
Negative integers
c
2011
Ray Seyfarth
c
2011
Ray Seyfarth
=
=
=
0
1
2
= 127
= -128
= -127
= -126
=
=
=
-2
-1
0
c
2011
Ray Seyfarth
Addition
Lets convert and add -29124 + 125
29124 = 0111000111000100
Negate = 1000111000111011
Add 1 = 1000111000111100
125
= 0000000001111101
Now add
1000111000111100
0000000001111101
---------------1000111010111001
Negate
Add 1
0111000101000110
0111000101000111
28999
c
2011
Ray Seyfarth
Binary multiplication
1010101
10101
1010101
1010101
1010101
11011111001
c
2011
Ray Seyfarth
Bits
32
64
80
Exponent
8
11
15
Exponent Bias
127
1023
16383
Fraction
23
52
64
Precision
7 digits
16 digits
19 digits
c
2011
Ray Seyfarth
1.0010101 2 = 1001.0101
= 23 + 1 + 22 + 24
= 8 + 1 + 0.25 + 0.0625
= 9.3125
64 Bit Intel Assembly Language
c
2011
Ray Seyfarth
Implicit 1 bit
31 20
sign bit
23 22
exponent
0
value
1011.10101 = 1.01110101 23
The leading 1 bit is not stored
The value (fraction) field is 01110101000000000000000
c
2011
Ray Seyfarth
00000000
00000004
00000008
0000000C
00000010
00000014
00000018
00000000
0000803F
000080BF
0000E03F
0000F542
CDCC8C3F
F9021550
c
2011
Ray Seyfarth
4
5
6
7
00000004
00000008
0000000C
00000010
0000803F
000080BF
0000E03F
0000F542
one dd 1.0
neg1 dd -1.0
a dd 1.75
b dd 122.5
c
2011
Ray Seyfarth
8 00000014 CDCC8C3F
d dd 1.1
c
2011
Ray Seyfarth
Sign bit is 1
Whole part is 12 = 11002
Fraction is 0.25 = 0.01
Scientific notation 12.25 = 1.100012 23
c
2011
Ray Seyfarth
c
2011
Ray Seyfarth
c
2011
Ray Seyfarth
c
2011
Ray Seyfarth
=
=
111.12
100.0112
11112
111102
1111000002
100000.11012
Conversion to float format should be apparent by now
*
c
2011
Ray Seyfarth