Number Representation - Steps to doing each one Flashcards
Radix R -> Decimal
This is just a way to remember positioning. Given a number to any base the most righthand side is the lowest position 0 (if there are no decimals or looking at the integer part only). You simply just multiply the value in that position by the base to the power of the position. For example if we had 4321 base 5, the most righthand side is the lowest position and hence 1 is in position 0 to to find the value you do 1 * 5^0 = 1*1 = 1. You do the same for every value and then sum them together to get the value of the new base.
Decimal to Radix R
The is just the reverse of Radix R to Decimal, given a number in this case a number to base 10 convert it to a different base. We just divide by the base and record the remainder. Then reading from bottom to top that is the number of the base. For example 586 base 10 to base 5 divide 586 by 5 which will give you 117 remainder 1. Then take 117 divide by 5 which is 23 remainder 2. Keep going untill the answer is 0 ie in this example we eventually get to 4 divided by 5 = 0 remainder 4
Decimal -> Binary
Given a decimal number we simply divide it by the base 2 and recored the remainder, until you get the answer to 0 with some remainder (This is similar to Decimal -> Radix R). Then you read the values from bottom to top to get your binary number to base 2.
Binary -> Decimal
We use the understanding of Radix R positioning to find a decimal from binary. Again the most righthand side is the lowest position at 0. Once you find all the values, in this case it will be the 0 or 1 mulitplied by the base 2 to the power of the position, you then sum them together to get the decimal base 10
Decimal -> Hex
Giuven a decimal number wi simply just divide it by the base 16 until you get to the answer 0 with some remainder. You then read from bottom to top to get the hex value base 16. Note that once the remainder is greater than 9 it turns into letters from 10 to 15 represented by A to F respectively.
Hex -> Decimal
We use the understanding of Radix R positioning to convert hex into decimal. Again the most righthand side it the lowest position 0. You just do value * base 16 to the power of the position will give you a value and then you just sum them together to get the decimal value. As we know hex uses letter from 10 - 15 so make sure to convert them from the letters to digits when doing the multiplication.
Binary -> Hex
Four binary digits make up one hex digit, so group digits into sets of four starting from the righthand side. If there is less than 4 digits then just pad with zeros to make it four. Then just find the hex value of them by converting it to decimal. For example 101100 in binary we need to pad this with zeros to split it and then pad it with zeros, so now it looks like this 0010 1100 and then convert this to decimal. We know 0010 is 2 and 1100 is 12 therefore this is 2C in hex. (NOTE: It better to just remember all the binary values from 0 to 9 and A to F).
Hex -> Binary
Simply convert the Hex values into binary. This is essentially knowing each of the binary values from 0 to 9 and A to F
Radix R -> Decimal/Binary/Hex (Fixed Point)
Fixed point essentially means there is now a decimal point or a fraction added, ie ab.cd. This is the exact same as normal Radix R but now the fractions are negative powers to represent their position. For example if we had 10.10 base 2 (binary) and wanted to convert it to decimal base 10 we would take the integer side which is just 10 set out the positions and multiple as normal so 0 is in 0 position and 1 is in the 1 position. Now for the fraction you do the same thing but its now negative power so 0.10 or .10 the 1 is in the -1 position and 0 is in the negative 2 position.
!!!!!!
Now when it comes to the power we need to now 10^n, 2^n and 16^n
10^n is just shifting the decimal so if 10^1 = 1 then 10^-1 is 0.1, 10^-2 is 0.01,e tc
2^n is just halfing so if 2^0 = 1 then 2^-1 is 0.5, 2^-2 is 0.25, etc
16^n is just
Decimal/Binary/Hex -> Radix R (Fixed Point)
Going the opposite way is just the same thing as normal Radix R where we divide by the base and record the remainder adn then read from bottom to top. But for the fractions we actually multiply by the base and then read bottom to top.
Decimal -> Binary (Fixed Point)
Same as standard decimal to binary, but now for the decimals you must multiply by the base and record the number in front of the decimal point and then carry the fraction until a certain precision which you will be told. Read top to bottom
Binary -> Decimal (Fixed Point)
Same as standard binary to decimal except the fractions need to be multiplied by negative powers because of their position
Decimal -> Hex (Fixed Point)
Same as decimal to hex but for the fractions yu are multiplying the base and recording the value in front of the decimal point and carrying over the fraction to do it again until a certain precision. You are then reading from bottom to top to determine the value.
Hex -> Decimal (Fixed point)
Same as hex to decimal but again the positioning is now negative and hence the powers will all be negative. But you essentially do the same thing and then sum the values together. Note that the answer migh be different from decimal to hex due to extra precision.
Signed Hex -> Decimal
First note that Hex to decimal is unsigned. But for a signed hex you first need to convert the hex into binary (this also happens for a fixed point). We then need to invert the bits, this is where 1s become 0s and 0s become 1s. We then add + 1 to the inverted bits amd then either convert back to hex or from the binary figure out the decimal. Once that is done given that it is signed which means its negative you just a negative sign to the front.