N = Natural - Positive integers
Z = Whole - Positive and Negative integers
Q = Rational - values that can be represented as ratios, fractions or decimals - includes recurring numbers
Irrational - cannot be expressed as a fraction - surds and endless decimals
R = Real - rational and irrational numbers - can be used for measurement
Ordinal - first, second, third
Base 2 = binary
Base 10 = denary
Base 16 = hexadecimal
The base can be represented through a subscript value:
112 = 3 in binary
1110 = 11 in denary
Why use hex?
shorthand binary
fewer mistakes
easier to remember
takes up less memory
Can be 16 bits
Two types - signed and unsigned
Signed can be negative (127 to -128)
Use two's compliment on signed values
Only use this if the binary number begins with a 1
Flip the bit - 1 = 0 and 0 = 1
Add 1 bit
1011 0011
begins with a 1 so apply two's complement
1011 0011 - flip the bits
0100 1100 - add 1
0100 1101
convert to denary and make it negative
= 77
so 1011 0011 = -77
- 99
99 in binary is 0110 0011
apply two's compliment
0110 0011 - flip the bits
1001 1100 - add 1 bit
1001 1101
so -99 = 1001 1101
0 + 0 = 0
1 + 0 = 1
1 + 1 = (1) 0
0 + 1 = 1
1 + 1 + 1 = (1) 1
0100 1101 + 0011 1000 = 1000 0101
To subtract, make the second value negative, then add
Ignore any overflow errors
0101 0110 - 0001 1111
make 0001 1111 negative:
1110 0000 + 1 = 1110 0001
0101 0110 + 1110 0001
In binary, to multiply/ divide you must double/ halve numbers.
To multiply, you will double and perform a left shift.
To divide, you will halve and perform a right shift.
Division example:
1001 0010 = 146
1001 0010 / 2
to halve you perform one right shift
0100 1001 = 73
1101 1000 = 216
1101 1000 / 4
to divide by 4 you perform two right shifts
0011 0110 = 54
Multiplication example:
0001 1101 * 4
to multiply by 4, perform two left shifts
0111 0100
0000 1111 * 6 = 0101 1010
to multiply by 6, multiply by 2 and by 4 then add
0000 1111 * 4 = 0011 1100
0000 1111 * 2 = 0001 1110
The column headings to the left of the point remain the same, the headings to the right halve
8 4 2 1 . 1/2 1/4 1/8 1/16
1100.1010 = 12.625
not all decimals can be represented - rounding error
limits the number of values, especially if signed
Can store almost any decimal as the point can move
10110.011 0001
Sign - positive or negative
Mantissa - the main part of the number
Exponent - moves the floating point
A positive exponent moves to the right, a negative exponent moves to the left
Standard form for binary - stores a number more efficiently - gets rid of excess 0 or 1
Ignore the exponent - will begin 0.1 (positive) or 1.0 (negative)
Example
1.111110110 1000
the point will move 5 places to the right
1.0110 - mantissa
exponent = exponent + -5 (5 places right) = 1000 + 1011
exponent = 10011
1.0110 10011
Denary to normalised binary
17.25 = 010001.01
Exp = 0000
TO NORMALISE:
010001.01 - move 5 to the left = -5
Exp = 5
Mantissa = 0.1000101
Exp = 0101