Trusted answers to developer questions

Educative Answers Team

Since computers only understand binary numbers but need to perform operations involving negative numbers, there is a way to represent negative numbers (like positive numbers) in a binary format. A negative binary number can be made from its positive version in the following two ways:

This is a simple approach that adds an extra bit (i.e., *sign-bit*) to detect the sign of a number. $1$ indicates a *-ve* number, and $0$ indicates a *+ve* number or vice versa (depending on the architecture of the computer).

For example, if $7 = (0111)$_{2} then $-7 = (1111)$_{2}.

A drawback is that the adders, in the underlying hardware of the computer, need to determine the *sign-bit* of an operation’s result. Due to this, and other disadvantages, the sign-bit representation of negative numbers is now obsolete.

In this representation, the left-most bit is considered to be the *sign-bit* (without adding an extra bit), where $1$ is a -ve and $0$ is a +ve. This reduces the range of positive numbers that can be represented (using $n$ bits) from $2^n - 1$ to $2^{n-1} - 1$. Despite this drawback, it is now the standard way of representing negative binary numbers.

To convert a positive number into a negative number, using the two’s complement representation, invert all of the bits of the number and add $1$.

RELATED TAGS

binary

architecture

number

arithmetic

Copyright ©2022 Educative, Inc. All rights reserved

RELATED COURSES

View all Courses

Keep Exploring

Related Courses