Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

simple binary question (negatives)

$
0
0
there are various ways to represent negative numbers in a binary system, why doesnt a computer get confused?

For example, with 3 bits, ones compliment
010 = 2
101 can mean 7 or -2

as far as I can tell, other methods have problems as well

the question is, how do you avoid problems like this? why does a computer know that you're using a negative and not a straight up binary number?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>