2’s Complement Hexadecimal Addition

AI Thread Summary
The discussion clarifies the addition of hexadecimal values, specifically 0xD and 0x9, which equals 0x16. It explains that 0xD represents 13 in decimal and 0x9 represents 9, leading to a decimal sum of 22. The confusion arises from interpreting 22 as equal to 0x16, which is incorrect in a direct sense. Instead, the hexadecimal notation is crucial; 0x16 in hexadecimal equals 22 in decimal. The conversation emphasizes the importance of understanding the distinction between hexadecimal and decimal systems, highlighting that 0x10 equals 16, and thus 0x16 is equivalent to 22 in decimal terms.
siid14
Messages
1
Reaction score
0
TL;DR Summary
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:
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top