4.1 (DATA TYP) Flashcards
1
Q
What are 2 ways we can represent negative numbers in binary?
A
Sign and magnitude
Twos compliment
2
Q
How does sign and magnitude work?
A
The first bit is used as a sign
if it is a 0 the number is positive, if it is 1 it is negative
Halves the maximum value
3
Q
How does twos complement work?
A
Invert the binary bits
Add one
e.g.
12 => 01100
01100 => 10011
+1
10100
The most significant bit now represents the negative starting point (-16) then the rest represent how many more it is than that (+4) giving the number (-16+4=-12)
4
Q
How to normalise a floating point number
A
remove leading 1s (negatives) or 0s(positives)
000011001.01
01100101 5steps therefore 0101