| Twos Complement Value | |
| Base Ten Value | |
Use this tool to practice 8-bit two's complement notation. You can ask for a randomly generated value in base 2 (2's complement) or in base 10 (which will generate random numbers between -128 and 127)
Click the "random 2's Comp" button to get a randomly generated two's complement number. You will be expected to enter the corresponding base ten integer in the other field. If you prefer to start with a decimal integer, press the "random Base 10" button instead. You should be comfortable with both types of conversions.
Once you've gotten an answer, click on the "check answer" button to see if you got it right. If you didn't get it correct, try again...
This program is written in JavaScript, so you can use the "view source" command to see what's going on. Unfortunately, JavaScript doesn't have a twos complement feature built in, so I had to do it myself. I generated a random binary string, and as I was building the value, I determined the effect each digit would have on the overall value.
This program is still a little easy to be considered a suitable final project for this class.