Sunday, October 16, 2016

A Hex Upon Numerals

BASE 16

0123456789abcdef

Definition

In mathematics and computing, hexadecimal (also base 16, or hex) is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F (or alternatively a, b, c, d, e, f) to represent values ten to fifteen. -- https://en.wikipedia.org/wiki/Hexadecimal

Notes

  • Hex numbers uses digits from 0..9 and A..F
  • 0xVALU  - Unix/C prefix
  • Other than 0xVALU, VALU16 is a common notation
  • Each character is the equivalent of a nibble (4 bits)

Converting hex (BASE 16) to decimal (BASE 10)

A byte can be represented as:

n·16^3 n·16^2 n·16^1 n·16^0

OR

n·4096 n·256 n·16 n·1

*Any nonzero number raised to the zero power is equal to one (i.e., n^0=1). This concludes that all nonzero numbers raised to the zero power are equivalent because they all equal 1. Note that it is any nonzero number, since 00 is undefined.

Conversion Examples

0x31 = (3·16^1)+(1·16^0) = (48) + (1) = 49
0xc9 = (12·16^1) + (9·16^0) = (192) + (9) = 201
0x1f = (1·16) + (15·1) = 31

Decimal to Hexadecimal to Binary Conversion Table

Dec Hex Bin
B10 B16  B2 
0 0 00000000
1 1 00000001
2 2 00000010
3 3 00000011
4 4 00000100
5 5 00000101
6 6 00000110
7 7 00000111
8 8 00001000
9 9 00001001
10 a 00001010
11 b 00001011
12 c 00001100
13 d 00001101
14 e 00001110
15 f 00001111
16 10 00010000
17 11 00010001
18 12 00010010
19 13 00010011
20 14 00010100

References




No comments:

Post a Comment