MHB How Can I Easily Tackle Binary and Hexadecimal Problems?

  • Thread starter Thread starter Amathproblem22
  • Start date Start date
  • Tags Tags
    Binary hexadecimal
AI Thread Summary
The discussion focuses on methods for converting between binary, decimal, and hexadecimal systems. The user outlines their approach for binary to decimal conversion by summing the values of active bits, and similarly describes their method for decimal to binary conversion using repeated division by 2. For binary to hexadecimal, they explain grouping binary digits into sets of four and converting each group, while hexadecimal to binary is achieved by converting each hexadecimal digit directly. The conversation also touches on the ease of these conversions and confirms the correctness of the methods used. Overall, the user seeks efficient strategies for tackling these numerical conversions.
Amathproblem22
Messages
12
Reaction score
0
I don't need help with a problem just help with easy ways of tackling the problems. Below are my current methods. (Hopefully, all is correct I was in a rush).

Binary to Decimal:
1286432168421
11110001

I already know $$128+64+32= 224$$ so then $$ 16+1=17$$, meaning $$224+17=241$$

Decimal to Binary:
$$79$$
1286432168421
01001111
So I do this by basically figuring what adds up to 79 or by figuring if the number can fit into any (hopefully that makes sense).

Binary to Hexadecimal:
84218421
10100101

I break it up into two sets of 8-4-2-1 and add up the 1's below it accordingly. $$10=A$$ in the first column, and $$5$$ in the scond column so $$A5$$

Hexadecimal to Binary:
$$B4$$

$$B=11,4=4$$ so I but ones in the columns above so it adds up to the desired numbers leaving me 10110100.

Hexadecimal to Decimal
Using B4 from above = 11, then times that by 16 which in this case is easy and = 176 then adding 4 = 180
 
Technology news on Phys.org
The simplest way to change decimal to binary repeated division by 2. 79/2= 39 with remainder 1. 39/2= 19 with remainder 1. 19/2= 9 with remainder 1. 9/2= 4 with remainder 1. 4/2= 2 with remainder 0, 2/2= 1 with remainder 0 1/2= 0 with remainder . So 79= 100111. Notice that "1"s and "0"s are the reverse of those calculations.

Binary to hexadecimal is easy because 16= 2^4 = 10000 in binary. Divide the binary number into groups of 4 digits: 10100101= 1010 0101. Yes, 1010 is 8+2= 10 which is represented by "A" in hexadecimal and 0101 is 4+ 2= 6. 10100101 in binary is A6 in hexadecimal.

To go from hexadecimal to binary is also easy- convert each hexadecimal "digit" to binary.

B= 8+ 3= 1011 and 4 is 0100 so B4 is 10110100.
For something more complicated, E423BF: E= 8+ 4+ 2= 1110. 4= 0100, 2= 0010, 3= 0011, B= 1011, and F is 1111 so E423BF is 111001000010001110111111 in base 2.
 
Country Boy said:
The simplest way to change decimal to binary repeated division by 2. 79/2= 39 with remainder 1. 39/2= 19 with remainder 1. 19/2= 9 with remainder 1. 9/2= 4 with remainder 1. 4/2= 2 with remainder 0, 2/2= 1 with remainder 0 1/2= 0 with remainder . So 79= 100111. Notice that "1"s and "0"s are the reverse of those calculations.

Binary to hexadecimal is easy because 16= 2^4 = 10000 in binary. Divide the binary number into groups of 4 digits: 10100101= 1010 0101. Yes, 1010 is 8+2= 10 which is represented by "A" in hexadecimal and 0101 is 4+ 2= 6. 10100101 in binary is A6 in hexadecimal.

To go from hexadecimal to binary is also easy- convert each hexadecimal "digit" to binary.

B= 8+ 3= 1011 and 4 is 0100 so B4 is 10110100.
For something more complicated, E423BF: E= 8+ 4+ 2= 1110. 4= 0100, 2= 0010, 3= 0011, B= 1011, and F is 1111 so E423BF is 111001000010001110111111 in base 2.
This is an easier version of what you were saying I guess halving by two and put a 1 if the number above is odd and a 0 if the number is 0.
01249193979
01001111

Assuming you added A6 wrong? and dropped a 1 off 100111? Or was I wrong lol
 
Except that I would never say "halving by 2" (what else can you halve by?) that is essentially what I said.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top