Title: NumberING Systems: bInary, decImal, and hexadecImal
1DFSC 1317 Introduction to Digital Forensics and
Information Assurance
- 02
- NumberING Systems bInary, decImal, and
hexadecImal
2Basic operation performed by a computer
- Arithmetic Operations Addition, subtraction,
multiplication and division - Logical operations the sign or the comparative
magnitude of two numbers - Data transfer Moving data from one location to
another in the memory. - Input-output operations Controlling the
reading/writing of information into or out of the
computer
3On Digital Computers
-
- Digital computers store numbers in an entity (or
unit) called a word which consists of a string of
binary digits, or bits. Various number systems
are used to represent mathematical numbers. Some
commonly used number systems are hexadecimal
(base 16), decimal (base 10), octal (base 8), and
binary (base 2). For example, in a decimal
system the number 8,410 is represented in powers
of ten as - 8?103 4?102 1?101 0?100 8000 400 10
0 8,410 -
4On Digital Computers (Contd)
-
- A method known as the doubling procedure is as
follows. Given a decimal number N, it can be
decomposed as - N 2Q1 R1 (Q1 N/2 - remainder)
- Q1 2Q2 R2 (Q2 Q1/2 - remainder)
- . .
- . .
- . .
- Qk 0 Rk1 etc.
- The corresponding binary number is obtained by
writing the remainders Rk1, Rk, ... , R1 in the
reverse order as - B Rk1RkRk-1 ... R1
5Example
-
- Convert the decimal number N 8,410, to a binary
number. - Solution
- Perform sequential division by 2 as follows
- 8,410 (2?4,205) 0 65 (2?32) 1
- 4,205 (2?2,102) 1 32 (2?16) 0
- 2,102 (2?1,051) 0 16 (2?8) 0
- 1,051 (2?525) 1 8 (2?4) 0
- 525 (2?262) 1 4 (2?2) 0
- 262 (2?131) 0 2 (2?1) 0
- 131 (2?65) 1 1 (2?0) 1
- The binary equivalent of 8,410 is then given by
collecting the remainder digits from the last to
the first - 10000011011010 1?1213 0?212 0?211 0?210
0?29 0?28 1?27 1?26 0?25 1?24 1?23
0?22 1?21 0?20
6Representations of Numbers
- Numbers are usually represented using the
normal form notation. That is, -
- x m.10E for 10-1 lt ?m? lt 1
- where for x ? 0, m is called the mantissa and E
is the exponent. By convention, the number zero
has the normal notation, 0.100.
7Significant Digits
- If a number is written in standard decimal,
floating-point form, or in normal form such that - x 0.d1 d2 d3 ... dk?10n
- with d1 ? 0 and dk ? 0, we say that this number
has k significant digits (or significant figures)
which indicates those digits that can be used
with a confidence relative to the true value of
the number.
8Significant Digits (Contd)
- Note that the zeros which are used only to shift
the decimal point are not counted as significant
figures. The leading zeros may or may not be
significant. For example, - x 0.0002815 has 4 significant figures!
- x 1,200 may have 4 significant figures!
- Some examples are
- 46.45072800 0.46450728?102 (with 8
significant digits) - -335.12 -0.33512?103 (with 5
significant digits) - 0.00517 0.517?10-3 (with 3
significant digits) - 0.74 0.74?100 (with 2
significant digits)
9Computer Representation of Numbers
- The decimal equivalent of the binary number
represented in Figure 1 is given by - -(0?26 0?25 0?24 1?23 0?22 1?21
1?20) - -(0 0 0 8 0 2 1)
- -11
-
- Figure 1 Binary representation of an integer
using an - 8 bit word (or Byte)
10Example
- Determine the largest integer that can be
represented by an 8 bit machine. - Solution
- Imax (1?26 1?25 1?24 1?23
1?22 1?21 1?20) - ( 64 32 16 8 4
2 1 ) - (127)
- (27 - 1)
- In general
- Imax 2(n -1) - 1 Imin -2(n -1) -
1 - For a binary computer utilizing 32 bit words,
- Imax 2,147,483,647
11Floating-Point Representation
- A floating-point number is written as
- x (sign)m.b(sign)E
- where m is the mantissa, b is the base (b 2
for a binary system), and E is the exponent.
12Example
- Determine the smallest, positive, nonzero,
floating point number that can be represented by
an eight bit machine using binary system with one
bit spared for the sign of the mantissa, one bit
for the sign of the exponent, and two bits for
the digits of the exponent
Solution m (0?23 0?22 0?21 1?20) m
( 0 0 0 1 ) 1 E
-(1?21) (1?20) -(21) - 3 Number 1?2-3
(which is equal to 0.1250 in decimal system)
13Decimal Numeral System
- Base 10 positional notation
- 1010 1103 0102 1101 0100
- 11000 0100 110 01
- 1010
- Number set (0, 1, 2, , 8, 9)
- Operations addition, multiplication, etc.
- Numbers of same value are longer than Hex but
shorter than Bin - Not so easy to convert into Bin or Hex
14Binary Numeral System
- Base 2 positional notation
- 1010 (B) 123 022 121 020
- 18 04 12 01
- 10 (in decimal)
- Number set (0 1)
- Operations addition, multiplication, etc.
- Addition 1001 1100 10101
- Good for computer systems logical gates with
only two different values or states Can be
easily converted into Hex (4 Bin bits ?1 Hex bit)
15Hexadecimal Numeral System
- Base 16 positional notation
- 1010 (H) 1163 0162 1161 0160
- 1 4096 0 256 1 16 0 1
- 4112 (in decimal)
- Number set (0 9, A, B, C, D, E, F)
- Operations addition, multiplication, etc.
- Numbers of same value are shorter (vs. binary and
decimal) - Can be easily converted into Binary (1 Hex bit ?
4 Bin bits)
16Binary ?? Hexadecimal??Decimal
17File Extension ? Description ? Hex Signature BMP ? Windows Bitmap Image ? 42 4D xx xx GIF ? Graphics Interchange Format File?47 49 46 38 39 61 xx xx GIF ? GIF87a ? 47 49 46 38 37 61 xx xx GIF ? GIF87b ? Trailer 00 3B xx xx ICO ? Windows Icon File ? 00 00 01 00 xx xx JPEG, JPG ? Compressed graphics file ? FF D8 FF E0 xx xx 4A 46 49 46 00 xx xx FF D8 FF E1 xx xx 45 78 69 66 00 xx xx PNG ? Portable Network Graphics File ? 89 50 4E 47 0D xx xx TIFF, TIF ? Tagged Image File Format ? 49 49 2A 00 xx xx
18Hash Table