WEEK 2 – Video Notes UNSIGNED BINARY Cannot represent negative values POSITIONAL NUMBERING SYSTEMS The decimal system is an example of so Called as a base-ten number system (1-10) Digits represent different values depending on position (34 or 43) Binary is another example Used in basically all computer systems Base-two number system (1 and 0 - bits) The orders and arrangement represent a different value Radix notation 1001010 is a decimal number 100102 is a binary number 100105 is a base-five number Prefix notation For binary numbers the prefix is 0b (0b01010 should be interpreted as binary) Grouping In decimals you group numbers in three digits (100.040.039) Bits are grouped in 8 digits (bytes) or 4 digits (nybble) BASE CONVERSTIONS Subtraction approach Division remainder approach FRACTIONAL COMPONENT Numbers can have one in any base 51.1 (decimal point); 1011.1101 (binary point) In order to convert it is the same process as normal numbers but using negative exponents Some values might have an infinite series of digits in other bases (e.g. 2/310 = 0.666…10 = 0.23) When not possible to represent a fractional value in a specific base you have to specify the digits of accuracy (how many decimal points) e.g. 0.310 in binary is 0.01100 to five bits of accuracy to the right of the binary point SIGNED-MAGNITUDE BINARY the most significant bit of a number is going to represent the sign of the number 0 represents positive and 1 represent negative e.g. 011012 = 1310 and 110112 = -1110 + simple and intuitive + easy to convert from unsigned values - difficult to perform arithmetic (as the sign bit has no value it needs special logic to deal with it) - there are two representations of 0 (makes no sense mathematically) 0000 0000 = positive zero byte; 1000 0000 = negative zero byte ONE’S COMPLEMENT BINARY The complement of 0 is 1 and vice versa (0 -> 1; 1 -> 0) So the complement of a number becomes the negative representation Similarly to unsigned, when the value starts with a 1 is negative and with 0 is positive When it’s a positive value the number is the same as if it was unsigned + addition is easier than in signed-magnitude (easier to perform arithmetic) - still two representations of 0 0000 0000 positive zero byte; 1111 1111 negative zero bytes TWO’S COMPLEMENT BINARY Most significant bit represents a negative value The first number value holds but it turns negative and the following numbers add up to it To convert positive numbers is the same as unsigned but adding a 0 to the front For negative numbers, simply convert it to one’s complement and then add ‘1’ to the value + no bits with special meaning, therefore simple circuits Simpler to perform arithmetic compared to any other ones of the representations + single representation of 0 (0000 0000) - no disadvantages :) HEXADECIAMAL A form to represent binary numbers which is simpler for humans to read Base-16, meaning it needs 16 digits: