Denary, binary and hexadecimal
Place values, converting denary to binary and back, and why hex is used for bytes.
Transcript
Computers store everything as binary, using only zeros and ones. Each zero or one is a bit, and eight bits make a byte.
We count in denary, base ten, where each place is worth ten times more. Binary is base two, so each place is worth two times more.
In a byte the place values are one hundred and twenty eight, sixty four, thirty two, sixteen, eight, four, two, and one.
To change denary into binary, write the place values, then ask: does each one fit into the number? Let's convert one hundred and fifty.
One hundred and twenty eight fits, so write a one, and twenty two is left over. Sixty four and thirty two don't fit, so those are zeros.
Sixteen fits, leaving six. Eight doesn't fit. Four fits, two fits, and nothing is left. One is a zero. The answer is one zero zero one zero one one zero.
To go back, add up the place values that have a one. One twenty eight, sixteen, four and two make one hundred and fifty.
Binary numbers get long and hard to read. Hexadecimal is base sixteen. It uses the digits zero to nine, then the letters A to F for ten to fifteen.
To convert, split the byte into two nibbles of four bits. Each nibble becomes one hex digit. One zero zero one is nine, and zero one one zero is six. So one hundred and fifty is nine six in hex.
Hex is used for colour codes, M A C addresses, memory addresses and error messages. It is shorter, easier to read, and less error prone.
Binary is base two, denary is base ten, and hex is base sixteen. Three ways to write the same number.
More in this series
2:30Binary addition, overflow and shifts
Adding binary numbers with carries, overflow when a ninth bit is needed, and logical shifts as multiply and divide.
2:12Two's complement
Negative numbers in binary: the -128 place value, invert and add one, and reading a signed byte.
1:45Text: ASCII and Unicode
Character sets give every character a code. ASCII's 128 codes, Unicode's millions, and the storage trade-off.
1:27Images
Pixels, resolution, colour depth, image file size and metadata.
1:38Sound
Sampling an analogue wave: sample rate, bit depth, quality against file size.
1:50Storage units and file sizes
Bit to pebibyte in steps of 1024, and calculating image and sound file sizes.
1:58Compression
Why files are compressed, lossy against lossless, and run-length encoding step by step.
5:38Unit 1 quiz
Ten questions with a think-time countdown and explained answers.