Data representation Flashcards
What is a natural number?
positive integer
What is a real number
Any number that’s real
What is a rational number
any number that can be represented with a fraction
What is an irrational number
Any number that can’t be represented with a fraction
How do you convert from denary to hex
0-9 = 0-9
10-15 = A-F
What is unsigned binary?
binary that represents exclusively positive numbers
How do you add binary
0 +0 = 0
0+1 = 1
1 +1 = 10
1+1+1 = 11
How do you multiply binary
Do the same thing as regular multiplication
What is two’s complement and how does it work?
it is a method of working with negative binary values, where the most significant bit is negative.
How do you convert denary to binary using twos complement
- Write out the binary version where it is positive.
- starting from the least significant bit write out all the numbers, until you reach the first one (first being the first on the right hand side) .
- Flip all the bits from then on, including the one
How do you subtract binary
Change the number you are subtracting, to a negative value, and add the two numbers together
How do you represent fixed point binary
all points after the decimal point are 2^-n
How do you convert floating point binary to denary.
- calculate the value of the exponent
-Move the binary point in the mantisa by the amount specified by the exponent.
or denary = mantissa * 2^exponent
How do you convert denary to floating point binary?
- Calculate the value into fixed point binary
- Normalize the binary by moving the decimal point to between the last 1 and the zero after that.
- Depending on how you moved the point, change the exponent to do the opposite of that.
Why use fixed points vs floating point?
Floating point has a much larger range of numbers that can be produced with the same number of bits.
Fixed point can be processed faster as the decimal doesn’t need to be calculated.
The error will always be the same.
better when speed is more important than precision.