Integers
Whole numbers. Includes zero and negative numbers
Real numbers
Positive or negative numbers which can, but don’t necessarily, have a fractional part
Character
A single symbol used by a computer
String
A collection of characters
Boolean
True or False
Binary addition
0 + 0 = 0
0 + 1 = 1
1 + 1 = 10
1 + 1 + 1 = 11
Sign magnitude binary numbers
The most basic way to represent negative numbers in binary. A leading 1 is added for a negative number, and a leading 0 is added for a positive number
Two’s complement
Much simpler way of representing negative binary numbers. Works by making the most significant bit negative. Converting to a two’s complement negative number is as simple as flipping all the bits in the positive version and adding 1
Subtracting in binary
The same as adding a negative number. Both numbers are converted to two’s complement and then added together. A positive number will begin with a 0 and a negative will begin with a 1
Floating point in binary
A decimal point is added after the rightmost bit of representing 1, and the bits continuing right after half in size each time. E.g. 4 2 1 . 0.5 0.25 0.125
Normalisation
The number is split into two parts: mantissa and exponent. In the case of 6.67×10, the mantissa is 6.67 and the exponent is -11. To normalise, the binary number is adjusted so that it start with 01 for a positive and 10 for a negative. The exponent is added after based on how many shifts in which the direction the number has been adjusted
Addition of normalised numbers
Modify the numbers so that the exponents are the same by manipulating the mantissa. The two mantissas can then be added as normal, making sure the final result is in a properly normalised form
Subtraction of normalised numbers
Works exactly the same as addition except the mantissas are converted to two’s complement
Logical shifts
Involves moving all bits in a binary number a specified number of places to the left or right, adding in additional 0s to the empty spots
Arithmetic shift
The same process as a logical shift, except instead of always filing with 0s, the most significant bit in the direction of shift is copied to fill the gaps
Masks
Can be applied to binary numbers by combining them with a logic gate
Character sets
A published collection of codes and corresponding characters which can be used by computers for representing text
ASCII
The leading character set before Unicode. Uses 7 bits to represent 128 different characters. American Standard Code for Information Interchange. Soon came into trouble when computers needed to represent other languages with different characters
Unicode
Solves the problem of ASCII’s limited character set. Uses a varying number of bits allowing for over 1 million different characters