1.4.1 - Data types Flashcards
How do you convert denary to binary?
Write base 2 columns right to left - up to the maximum possible value before the base number is larger than the denary number.
EG if number was 74 write 1 2 4 8 16 32 64 - 64 is the minimum value as 128 (the next column value) is larger than 74.
Select the numbers that add up to 74 - chooswe the largest possible number each time.
How do you convert a binary number to a hexidecimal number?
Split the binary number into groups of 4 bits.
Assign each group a value of 0-9:A-F.
Combine the results.
How do you convert hex to binary?
Seperate each digit. Each digit represents a group of 4 bits. Convert the digits into 4 bit groups.
Combine to get binary result.
How do you convert hex to denary?
The column base now represents 16s and the next value is 16 times the previous (1….16….256)
Times the hex value by the coressponding column base value and add the results together for the denary number.
How do you convert denary to hex?
First convert denary to binary
Then convert binary to hex
Explain M x B^N
M = Mantissa or Coefficient N = Exponent or order of magnitude B = Number Base
How does a negative exponent affect a calculation in comparison to a positive?
Positive moves the decimal point to the right
Negative moves the decimal point to the left
How do you convert a positive floating point number with a positive exponent into denary?
- Write down the mantissa
- Translate the exponent from binary to denary (N)
- Move the decimal point (N) places to the right (As the exponent is positive)
- Convert binary number to denary
How do you convert a positive floating point number using a negative exponent into denary?
- Write down the mantissa
- Find the twos compliment of the exponent (Read number from right to left - start flipping digits after the first 1) = (N)
- Move the decimal point (N) places to the left (As the exponent is negative)
- Convert binary number into denary
How do you convert a negative floating point number using a positive exponent into denary?
- Find the twos compliment of the mantissa (Read number from right to left - start flipping digits after the first 1)
- Translate the exponent from binary to denary = (N)
- Move the decimal point (N) places to the right (As the exponent is positive)
- Convert binary number to denary (Remember denary will be negative)
How do you normalise a positive binary number?
A positive number has a sign bit of 0 and the next bit is always a 1
How do you normalise a negative binary number?
A negative number has a sign bit of 1 and the next bit is always a 0.
Normalise 0.0001011 0101 held in an 8 bit mantissa and a 4-bit exponent
- The binary point needs to move 3 places to the right so that there is a 1 following the binary point.
- Making the mantissa larger means we must compensate by making the exponent smaller, so subtract the number of time the deciaml point moved from the exponent. In this case the exponent will now be 0010.
- The nomrlaised number is 0.1011000 0010
Normalise 1.1110111 0001 held in an 8-bit mantisaa and a 4-bit exponent.
- The binary point needs to move 3 places to the right so that there is a 0 following the binary point.
- Making the mantissa larger means we must compensate by making the exponent smaller, so subtract the number of time the deciaml point moved from the exponent. In this case the exponent will now be 1 - 3 = 1110 (-2)
- The normalised number is 1.0111000 1110.
How do you convert a positive denary number to a normalised floating point binary number?
- Convert the number into fixed point binary.
- Move the decimal point in front of the first 1.
- The mantissa is now equal to this new number. (Fill in the rest of the bits on the end with 0s if you have to make up 8-bits)
- The exponent is now equal to the amount of places you moved the decimal point.