Definition
Binary - In mathematics and digital electronics, a binary number is a number expressed in the binary numeral system or base-2 numeral system which represents numeric values using two different symbols: typically 0 (zero) and 1 (one).- https://en.wikipedia.org/wiki/Binary_number
Notes
- BASE 2 Counting method only uses 0 and 1
- One binary digit is called a bit
- Two digits are called a crumb, four digits are called a nibble, and eight digits are called a byte
- Lower Case letters start with 011xxxxx
- Upper Case letters start with 010xxxxx
- When counting, range 0-1, carry the 1 (i.e. 00000000, 00000001, 00000010, 00000011, 00000100, 00000101, 00000110, 00000111, 00001000, 00001001, 00001010 ...)
- 1+1=10
Converting binary (BASE 2) to decimal (BASE 10)
A byte can be represented as:
n·2^7 | n·2^6 | n·2^5 | n·2^4 | n·2^3 | n·2^2 | n·2^1 | n·2^0
OR
n·128 | n·64 | n·32 | n·16 | n·8 | n·4 | n·2 | 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
10 = 1·2^1 | 0·2^0 = 1·2 + 0·1 = 2111 = 1·2^2 | 1·2^1 | 1·2^0 = 1·4 + 1·2 + 1·1 =7
1011 = 1·2^3 | 0·2^2 | 1·2^1 | 1·2^0 = 1·8 + 0 + 1·2 + 1 = 11
Converting binary (BASE 10) to decimal (BASE 2)
2^4 2^3 2^2 2^1 2^0
16 8 4 2 1
Use the value in the second row to count to the value--you can use each value no more than 1 time (since we count 0..1). For example, we want to convert 22 to binary. To do this we need:
(1 x 16) + (0x8) + (1x4) + (1x2) + (0x1)
10110 = 22
Letter to ASCII to Binary Character Table
Letter | ASCII Code | Binary | Letter | ASCII Code | Binary |
---|---|---|---|---|---|
a | 097 | 01100001 | A | 065 | 01000001 |
b | 098 | 01100010 | B | 066 | 01000010 |
c | 099 | 01100011 | C | 067 | 01000011 |
d | 100 | 01100100 | D | 068 | 01000100 |
e | 101 | 01100101 | E | 069 | 01000101 |
f | 102 | 01100110 | F | 070 | 01000110 |
g | 103 | 01100111 | G | 071 | 01000111 |
h | 104 | 01101000 | H | 072 | 01001000 |
i | 105 | 01101001 | I | 073 | 01001001 |
j | 106 | 01101010 | J | 074 | 01001010 |
k | 107 | 01101011 | K | 075 | 01001011 |
l | 108 | 01101100 | L | 076 | 01001100 |
m | 109 | 01101101 | M | 077 | 01001101 |
n | 110 | 01101110 | N | 078 | 01001110 |
o | 111 | 01101111 | O | 079 | 01001111 |
p | 112 | 01110000 | P | 080 | 01010000 |
q | 113 | 01110001 | Q | 081 | 01010001 |
r | 114 | 01110010 | R | 082 | 01010010 |
s | 115 | 01110011 | S | 083 | 01010011 |
t | 116 | 01110100 | T | 084 | 01010100 |
u | 117 | 01110101 | U | 085 | 01010101 |
v | 118 | 01110110 | V | 086 | 01010110 |
w | 119 | 01110111 | W | 087 | 01010111 |
x | 120 | 01111000 | X | 088 | 01011000 |
y | 121 | 01111001 | Y | 089 | 01011001 |
z | 122 | 01111010 | Z | 090 | 01011010 |
References
- http://www.math.grin.edu/~rebelsky/Courses/152/97F/Readings/student-binary
- https://www.mathsisfun.com/numbers/binary-count-fingers.html
- https://en.wikipedia.org/wiki/Binary_number
No comments:
Post a Comment