I've been trying to understand how negative numbers are notated in binary. As far as I understand, base on articles like this one:
Negative numbers: Two's complement
There is some math and reverting involved. My problem is that when I use online converters, and when I do the math by myself, to check the value of the binary code that these types of formulas give me, the result is never negative, but rather its own unique value positive.
It seems to me that the code itself is not negative, but rather the context tells you is negative.
I'd appreciate any help I can get since I am working on an exercise that is supposed to show the binary, octal and hexadecimal values of any int
in C, and should be able to handle negative numbers, and I'm unsure how to handle negatives since adding a simple "-" before whatever notation seems rather underwhelming.