0 votes 0 votes Hi, Can someone please tell if gray code representation can also work for negative binary number? I’ve seen examples of gray code for only positive binary number not sure about negative , can someone pls clear the doubt ? Digital Logic digital-logic binary-codes general-topic-doubt + – krish71 asked Aug 1, 2022 retagged Aug 2, 2022 by Shubham Sharma 2 krish71 460 views answer comment Share Follow See 1 comment See all 1 1 comment reply ankitgupta.1729 commented Aug 3, 2022 reply Follow Share Since, you have not mentioned the meaning of “negative binary numbers”, so I am considering $2’s$ complement to represent signed numbers or more specifically signed integers. Suppose, you have to find gray code for $-2.$ Now, there can be many binary 2’s complement representation for $-2,$ for example, $110 = -2^2*1 + 2^1*1 + 2^0*0 = -4 +2 + 0 = -2$ $1110 = -2^3*1 + 2^2*1 + 2^1*1 + 2^0*0 = -8 + 4 +2 + 0 = -2$ $11110 = -2^4*1 + 2^3*1+2^2*1 + 2^1*1 + 2^0*0 = -16 +8 + 4 +2 + 0 = -2$ and so on. Now, the corresponding gray-code will be $101$ for $110$ $1001$ for $1110$ $10001$ for $11110$ and so on. So, there is no unique gray code for a single negative number. This is the problem with negative numbers but you will not find this problem with non-negative integers. 0 votes 0 votes Please log in or register to add a comment.