2’s Complement Hexadecimal Addition

Click For Summary
SUMMARY

The discussion clarifies the addition of hexadecimal values, specifically 0xD and 0x9, resulting in 0x16. It emphasizes the importance of the 0x prefix, which indicates that the numbers are in hexadecimal format. The conversion of hexadecimal to decimal shows that 0xD equals 13 and 0x9 equals 9, leading to a decimal sum of 22. The equivalence notation (≡) is used to illustrate that while 0x16 is not equal to 22, it is equivalent in the context of hexadecimal representation.

PREREQUISITES
  • Understanding of hexadecimal notation and the significance of the 0x prefix
  • Basic arithmetic operations in both hexadecimal and decimal systems
  • Knowledge of number base conversions, particularly between hexadecimal and decimal
  • Familiarity with equivalence notation (≡) in mathematical expressions
NEXT STEPS
  • Study hexadecimal addition techniques and practice with various examples
  • Learn about number base conversions, focusing on converting between hexadecimal and decimal
  • Explore the use of equivalence notation in mathematical contexts
  • Investigate the implications of using different number systems in programming and computer science
USEFUL FOR

Students, software developers, and anyone interested in understanding hexadecimal arithmetic and its applications in computing.

siid14
Messages
1
Reaction score
0
TL;DR
Working on 2's Complement Hexadecimal but still don't get the addition. I was looking at the post here: https://stackoverflow.com/questions/33322671/how-to-add-hex-numbers-using-twos-complement
The solution (green arrow) states that for example :

0xD + 0x9 = 0x16

Details :

0xD = 13,
0x9 = 9,
13 + 9 = 22,
22 = 0x16

Where does the 0x16 come from? I do get to add D + 9 = 13 + 19 = 22 so how come 22 is equal to 16 (assuming D + 9 = 16 is correct) How am I suppose this solution?
 
Technology news on Phys.org
siid14 said:
Where does the 0x16 come from? I do get to add D + 9 = 13 + 19 = 22 so how come 22 is equal to 16 (assuming D + 9 = 16 is correct) How am I suppose this solution?
D + 9 is not meaningful, and 22 is obviously not equal to 16. The 0x prefix is vital.

We can write 0xD + 0x9 = 0x16 in hexadecimal, or we can write 13 + 9 = 22 in decimal, or we can even write 0xD + 0x9 ≡ 22 (note the use of the ≡ sign here to show equivalence as opposed to equality).

Note that 0x10 ≡ 16, so 0x16 = 0x10 + 0x6 ≡ 16 + 6 = 22.
 
Last edited by a moderator:

Similar threads

  • Sticky
  • · Replies 13 ·
Replies
13
Views
8K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
Replies
29
Views
5K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 7 ·
Replies
7
Views
3K
Replies
60
Views
18K
  • · Replies 3 ·
Replies
3
Views
16K
  • · Replies 12 ·
Replies
12
Views
5K