2's Complement Dec-Bin Converter
A dec-bin converter uses 2's complement. Visit my Medium Post.
What is 2's complement?
Two's complement is the most common method of representing signed integers on computers. Note that signed integers represent both positive and negative numbers whereas unsigned integers represent non-negative numbers (zero or positive numbers) only.
Since it is expresses the negative numbers in binary form, we will only use this method when converting a negative denary number to binary. The complements are as below:
- 1's complement inverts the binary numbers;
- 2's complement adds a bit (1) or a fractional bit (0.0…1) to the inverted binary numbers.
Getting Started
These instructions will get you a copy of the project on your local machine.
Prerequisites
- VSCode
- You may use other code editor such as Sublime.
- Python 3.8.10
- You may use other version such as Python 3.7.9.
- You may refer to the installation process.
Downloading the Python File
Once you have installed the Python, you may download the 2s_complement.py and run it on your machine.
Have fun!
Contributing
Feel free to fork and give a star to my repo. If you have a good idea or find a bug in my codes, make a pull request and raise an issue at my repo anytime!
Coming Soon
I will be creating more repos, stay tuned!