Section 6 - Data types Flashcards
Conversions between denary, binary, and hexadecimal
Primitive Data Types, Binary and Hexadecimal
How do you convert from binary to hexadecimal?
To convert a binary number to hexadecimal, split the binary number into groups of 4 binary digits
Binary | 0011 | 1010 |1111 |1010
Hex | 3 | A | F | 9
0011 1010 1111 1010 = 3AF9
The opposite may also be done to translate from hexadecimal to binary
Primitive Data Types, Binary and Hexadecimal
How do you convert from denary to hexadecimal?
To convert a denary number to hexadecimal, the easiest way is to first convert the denary number to binary and then translate from binary to hexadecimal
Binary Arithmetic
1100 + 1110 = ?
1010 carry 1
Binary Arithmetic
What is the difference between sign and magnitude and two’s compliment?
Sign and magnitude:
* 00000011 = 3
* 10000011 = -3
Two’s compliment:
* 00000011 = 3
* 11111101 = -3
Binary Arithmetic
How do you convert a negative denary number to binary?
Convert the positive version of the number to binary, then flip each bit and add 1
-9 -> binary
Positive binary (9) : 0000 1001
Flip the bits : 1111 0110
Add one : +0000 0001
-9 = 1111 0111
flip the bits and add 1
Same can be done to convert binary -> denary: flip the bits and add 1
Binary Arithmetic
0000 1110 - 0000 1110 = ?
17 - 14
Do 17 + -14!
0000 0011 carry 1
WRITE ABOUT: mantissa AND exponent