is this a valid formula?
and is this calculation correct?
decimal 15
hex value "F"
((10h+F)-1h)+1h
1F
This is a discussion on hex 16's compliment within the Tech Board forums, part of the Community Boards category; is this a valid formula? and is this calculation correct? decimal 15 hex value "F" ((10h+F)-1h)+1h 1F...
is this a valid formula?
and is this calculation correct?
decimal 15
hex value "F"
((10h+F)-1h)+1h
1F
"Hence to fight and conquer in all your battles is not supreme excellence;
supreme excellence consists in breaking the enemy's resistance without fighting."
Art of War Sun Tzu
I have never even heard of a "hex 16's compliment"
I have heard about 1's and 2's compliment
What are you trying to do?
I thought to convert to hex 16's complement you still just reverse the bits and add 1, but to reverse the bits you just subtract the number from 15.
I'm not immature, I'm refined in the opposite direction.
Ok so he's just trying to do two's complement without converting first.
yeah it'd (for numbers between 0 and 15):
(F-x)+1
Expand what you wrote out and you are left with: 10h+F as -1 and +1 produce 0((10h+F)-1h)+1h
1F
Sounds correct to me thantos.
I'm not immature, I'm refined in the opposite direction.
here is the exact question.
The book doesn't disclose the 16's complimentWill taking the two's complement of a binary number and then converting to hex result in the same hex number as converting the original number to hex and taking its 16's complement?
"Hence to fight and conquer in all your battles is not supreme excellence;
supreme excellence consists in breaking the enemy's resistance without fighting."
Art of War Sun Tzu
I think you need to work that out for yourself, you should have enough knowledge to work some examples out on paper (or, perform a thought experiment).
If you want to have us check your work I think that will be acceptable but is against policy on the boards to just give an answer directly (sorry).
step1:
take the binary number 15:
0000 1111
flip its bits, add 1, then convert it to hex
step2:
take the binary number 15:
0000 1111
convert it to hex
once you have the hex, subtract it from 15, add 1, then compare the results to step1.
show us each step.
Last edited by BobMcGee123; 09-13-2005 at 05:31 PM.
I'm not immature, I'm refined in the opposite direction.
thanks for your insight.against policy on the boards to just give an answer directly (sorry).
I'm not trying to get a free answer. I need more direction for my research.
I was asking a question, and thantos requested the exact details that initiated my post.
Anyway, the reason for the post was to clarify the 16's compliment.
That is why my original post asked for insight on how to correct my understanding of the convertion algarithm.
Thantos, thank you for your constructive comments.
one more request for clarification.
Please anyone with constructive comments tell me if i'm off on this.
Code:n = total bits used B = radix/base ([(B^n)] - OriginalValue) = B^nCompliment 10101100b = 172d 01010011b = 83d// Flipped +1b// Add 1 ------------- 01010100b = 84d // 2's Compliment 10101100b = 172d = ACh 11111111b = 255d = FFh (FFh - ACh) + 1h = 54h = 84d = 01010100b
Last edited by xviddivxoggmp3; 09-14-2005 at 12:50 AM.
"Hence to fight and conquer in all your battles is not supreme excellence;
supreme excellence consists in breaking the enemy's resistance without fighting."
Art of War Sun Tzu
Dave,
Thanks for the info.
I figured out what i was doing wrong.
I have it perfect now.
That site helped.
I wasn't sure of what subjects to search for.
So it helped.
"Hence to fight and conquer in all your battles is not supreme excellence;
supreme excellence consists in breaking the enemy's resistance without fighting."
Art of War Sun Tzu