0

I used an online converter to convert 412 from decimal to base 4 (which is 12130), and then applied the r's complement formula to get its 4s complement (which is 21210). However, in 6bits, 21210 becomes 321210.

When I try to convert it to decimal by doing
3 x - 4^5 + 2 x 4^4 + 1 x 4^3 + 2 x 4^2 + 1 x 4^1,
I get a number in decimal that is way larger than 412.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • Note that a 'bit' usually means a "base two digit" -- in base 4, you have base 4 digits, for which there is not a convenient short name. – Chris Dodd Sep 07 '21 at 16:23

1 Answers1

0

You have your "conversion to decimal" wrong -- it should be:

-1 x 4^5 + 2 x 4^4 + 1 x 4^3 + 2 x 4^2 + 1 x 4^1

note the difference in the first term, dealing with the sign -- the '3' digit has a value of -1 in a 4s complement sign digit.

Chris Dodd
  • 119,907
  • 13
  • 134
  • 226