Converting signed magnitude binary to signed 2's complement - Electrical Engineering Stack Exchange most recent 30 from electronics.stackexchange.com 2019-07-20T12:03:05Z https://electronics.stackexchange.com/feeds/question/292233 http://www.creativecommons.org/licenses/by-sa/3.0/rdf https://electronics.stackexchange.com/q/292233 0 Converting signed magnitude binary to signed 2's complement HustleN https://electronics.stackexchange.com/users/142078 2017-03-14T04:42:15Z 2017-03-14T04:52:21Z <p>I have a simple question about converting from signed magnitude representation to signed 2's complement.</p> <p>I have no difficulty converting, for example, the signed magnitude 5-bit binary number 00100 (4 in base 10) to signed 2's complement, because it is 00100. Likewise, the signed magnitude 5-bit binary number 10001 (-1 in base 10) is 11111 in signed 2's complement.</p> <p>What I don't understand is how the signed binary number 10000 (this would be -0, correct?) is converted to 2's complement. Can anyone offer some insight? Thank you.</p> https://electronics.stackexchange.com/questions/292233/converting-signed-magnitude-binary-to-signed-2s-complement/292234#292234 1 Answer by old_timer for Converting signed magnitude binary to signed 2's complement old_timer https://electronics.stackexchange.com/users/985 2017-03-14T04:52:21Z 2017-03-14T04:52:21Z <p>some numbers like -0 in particular cannot be represented. is there a difference between +0 and -0? There is one or maybe two (or few)numbers that are a problem and they are around the end points. 10000 being minus zero if you see the sign bit set you negate the other bits, invert and add one so 1111 + 1 = 10000 or 0000, leaving you with the number 10000 in twos complement which is what -32 not -0. what about sign magnitude 11111 minus 15. 10001, that works fine. what about 00000 that works fine what about 01111, that works fine. so you have the one exception, if the sign is 1 and the magnitude is zero then flip the sign, else negate the magnitude and keep the sign.</p>