The Wayback Machine - https://web.archive.org/web/20240930224149/https://www.geeksforgeeks.org/binary-representations-in-digital-logic/
Open In App

Binary Representations in Digital Logic

Last Updated : 26 Aug, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

In the digital system of logic, binary forms have core functions with respect to data processing. Binary numbers systems in which only two states are possible-0 and 1 are used in digital circuits for mathematical computations for storing information as well as information transmission. Such techniques include sign and magnitude, one’s complement and two’s complement and etc which are used to represent both positive and negative numbers in digital systems so as to enable arithmetic and logic operations to work full well.

What is Binary Number System?

Binary is a base-2 number system that uses two states 0 and 1 to represent a number. We can also call it to be a true state and a false state. A binary number is built the same way as we build the normal decimal number. 

For example, a decimal number 45 can be represented as 4*10^1+5*10^0 = 40+5 

Now in binary 45 is represented as 101101. As we have powers of 10 in decimal number similarly there are powers of 2 in binary numbers. Hence 45 which is 101101 in binary can be represented as: 
 

2^0*1+2^1*0+2^2*1+2^3*1+2^4*0+2^5*1 = 45

The binary number is traversed from left to right. 

What does Binary Representation Imply in Terms of Digital Electronics?

In digital electronics, the capability of binary representation is central to encoding and processing of information. Binary numbers are used in digital systems such as computer to carry out arithmetic, storing and retrieval of data and to control and organize tasks. In binary representation all information has to be given in terms of a sequence of 0s and 1s which are then used to be processed by circuits.

For example, the decimal number is 7, and in binary format by using 8 bits it is 0111.

In binary systems, there is one bit present that will represent one power of two, so even when complicated data and operations are to be managed in hardware, they exist only in simple on-off states.

Types of Binary Representations in Digital Electronics

Sign and Magnitude Representation

 There are many ways for representing negative integers. One of the way is sign-magnitude. This system uses one bit to indicate the sign. Mathematical numbers are generally made up of a sign and a value. The sign indicates whether the number is positive, (+) or negative, (–) while the value indicates the size of the number. 

For example 13, +256 or -574. Presenting numbers in this way is called sign-magnitude representation since the left most digit can be used to indicate the sign and the remaining digits the magnitude or value of the number. 

Sign-magnitude notation is the simplest and one of the most common methods of representing positive and negative numbers. Thus negative numbers are obtained simply by changing the sign of the corresponding positive number, for example, +2 and -2, +10 and -10, etc. Similarly adding a 1 to the front of a binary number is negative and a 0 makes it positive. 

For example 0101101 represents +45 and 1101101 represents -45 if 6 digits of a binary number are considered and the leftmost digit represents the sign. 

But a problem with the sign-magnitude method is that it can result in the possibility of two different bit patterns having the same binary value. For example, +0 and -0 would be 0000 and 1000 respectively as a signed 4-bit binary number. So using this method there can be two representations for zero, a positive zero 0000 and also a negative zero 1000 which can cause big complications for computers and digital systems. 

The 2 complement notations used to represent signed magnitude numbers are: 

One’s complement

One’s Complement is a method which can be used to represent negative binary numbers in a signed binary number system. In one’s complement, positive numbers remain unchanged as before. 

Negative numbers however, are represented by taking the one’s complement of the unsigned positive number. Since positive numbers always start with a 0, the complement will always start with a 1 to indicate a negative number. 

The one’s complement of a negative binary number is the complement of its positive, so to take the one’s complement of a binary number, all we need to do is subtract 1’s equal to the number of digits present in the number from that number. This can also be achieved by just interchanging the digits of the number. Thus the one’s complement of 1 is 0 and vice versa. 

For example One’s Complement of 1010100: 
 

1111111
-1010100
0101011

The one’s complement of number can also be obtained by just interchanging the digits of the binary number. 

2. Two’s complement

Two’s Complement is another method like one’s complement form, which we can use to represent negative binary numbers in a signed binary number system. In two’s complement, the positive numbers are exactly the same as before for unsigned binary numbers. A negative number, however, is represented by a binary number, which when added to its corresponding positive equivalent results in zero. 

In two’s complement representation, a negative number is the 2’s complement of its positive number. If the subtraction of two numbers is X – Y then it can be represented as X + (2’s complement of Y). 

The two’s complement is one’s complement + 1 of a number in binary. 

The main advantage of two’s complement over the previous one’s complement is that there is no double-zero problem and it is a lot easier to generate the two’s complement of a signed binary number. In two’s complement arithmetic operations are relatively easier to perform when the numbers are represented in the two’s complement format. 

For example to represent -27 
27 in binary is: 00011011 
 

11111111
-00011011
11100100 <– 1’s Complement
+1
11100101 <– The 2’s Complement

The above 2 are the formats that can be too long practically. So real number representations are used. 

Real Number Representations

The goal is to represent a number with a decimal point in binary using the form. IEEE 754 standard defines how to encode a real number. This standard offers a way to code a number using 32 bits (as well as 64 bits), and defines three components: 

  1. The plus/minus sign is represented by one bit, the highest-weighted bit (furthest to the left). 
  2. The exponent is encoded using 8 bits (11 bits in 64 bit representation) immediately after the sign. 
  3. The mantissa (the bits after the decimal point) with the remaining 23 bits(52 bits in 64 bit representation). 

Analog and Digital Signals

  • Analog Signals: Analog signals are of analogue type and they are characterized by being continuous in form and fluctuate smoothly. They can have a large range of applications and are used in simple radio, audio and video systems.
  • Digital Signals: Digital signals are actually analogue and are spaced a good distance apart from each other and are basically any kind of data in the form of 0’s and 1’s. They are used in microprocessors, computers, telecommunication and in other digital products and devices.

Advantages

Binary System

  • Simplicity in hardware design.
  • Error detection and correction are not as complex as the other error control techniques.
  • Effective for computer based calculations as well as computerized data archiving.

Sign and Magnitude

  • They are easily understandable as well as easy to be implemented.

One’s Complement and Two’s Complement

  • This in turn helps to perform arithmetic operations easily and does not result to what we call dual zeroes.

Disadvantages

Sign and Magnitude

  • Zero creates problem to various operations because it has two symbols.

One’s Complement

  • Dual zeroes issue.
  • More complex arithmetic operations.

Two’s Complement

  • At least apparently more complex to comprehend at first, but in most instances, more effective overall.

Applications

  • Binary Numbers: Employed in all up-to-date computer-based processing and transmission methods.
  • Sign and Magnitude: Not used actively in practice for couple of decades but still can be useful in simple educational settings.
  • One’s Complement: Used in some of the older systems and networking protocols.
  • Two’s Complement: Common in today’s computers performing calculations because of its effectiveness and ease in computation.

Conclusion

Binary representation is one of the core aspects of digital systems right from computing. Of the three representation methods -sign and magnitude, one’s complement, and two’s complement, each has its appropriateness concerning the complexity of summing operations. Two’s complement is preferred in most of the modern systems because it has some benefits over the other methods; arithmetic operations becomes much easier with it and there are no dual zeroes.

Frequently Asked Questions on Binary Representations in Digital Logic-FAQ’s

For what purpose is binary applied in digital electronics?

Binary is used because it is simple to implement using digital circuits, which have only two states: encoded as ‘On’ with a value of 1 and ‘Off’ with a value of 0. For this reason, binary systems are dependable and performant for electronic computations, due to their simplicity.

What is working of Two’s Complement and what is the main difference between two’s complement and one’s complement?

The main benefit of two’s complement is the fact that unlike one’d signed, it has only one option for zero term which makes arithmetic as well as detecting errors easier.

What is the info exchange rate mode established by the 754 IEEE regulation for floating-point numbers?

The IEEE 754 standard represents floating-point numbers using three components: The floating point representation of an integer is a sign bit, an exponent, or precision and a fraction. This makes it possible for a broad spectrum with the corresponding value and obtain high accuracy in mathematical computation.



Similar Reads

Check if binary representations of 0 to N are present as substrings in given binary string
Give binary string str and an integer N, the task is to check if the substrings of the string contain all binary representations of non-negative integers less than or equal to the given integer N. Examples: Input: str = “0110", N = 3 Output: True Explanation: Since substrings “0", “1", “10", and “11" can be formed from given string. Hence all binar
9 min read
Serial Binary Adder in Digital Logic
Serial binary adder is a combinational logic circuit that performs the addition of two binary numbers in serial form. Serial binary adder performs bit by bit addition. Two shift registers are used to store the binary numbers that are to be added. A single full adder is used to add one pair of bits at a time along with the carry. The carry output fr
2 min read
Non-binary Counter in Digital Logic
A counter is a circuit that counts the number of occurrences of an input. The circuit consists of flip-flops which along with combinational elements are used for generation of control signals. If M = Total number of states, and n = Total number of flip-flop Then, M <= 2n If M = 2n ; Binary counter and M < 2n ; Non-binary counter Block Diagram
2 min read
Binary Decoder in Digital Logic
A binary decoder is a digital circuit that converts a binary code into a set of outputs. The binary code represents the position of the desired output and is used to select the specific output that is active. Binary decoders are the inverse of encoders and are commonly used in digital systems to convert a serial code into a parallel set of outputs.
7 min read
Difference between Programmable Logic Array and Programming Array Logic
Programmable Logic Array (PLA) and Programming Array Logic (PAL) are the categories of programming logic devices. In PLA or Programmable Logic Array, there are massive functions can be implemented. Whereas in PAL or Programmable Array Logic, there is finite functions can be implemented. The distinction between PLA and PAL is that, PAL have programm
5 min read
Find the number obtained by concatenating binary representations of all numbers up to N
Given an integer N, the task is to find the decimal value of the binary string formed by concatenating the binary representations of all numbers from 1 to N sequentially. Examples: Input: N = 12Output: 118505380540Explanation: The concatenation results in "1101110010111011110001001101010111100". The equivalent decimal value is 118505380540. Input:
5 min read
Maximize difference between odd and even indexed array elements by swapping unequal adjacent bits in their binary representations
Given an array arr[] consisting of N positive integers, the task is to find the maximum absolute difference between the sum of the array elements placed at even and odd indices of the array by swapping unequal adjacent bits of in the binary representation of any array element any number of times. Examples: Input: arr[] = {5, 7, 3, 1, 8}Output: 9Exp
12 min read
Rearrange array to make decimal equivalents of reversed binary representations of array elements sorted
Given an array arr[] consisting of N positive integers, the task is to rearrange the array such that the reversed binary representation of all the array elements is sorted. If the decimal equivalent of reversed binary representations of two or more array elements is equal, then the original value is taken into consideration while rearranging the ar
13 min read
Maximize difference between odd and even-indexed array elements by rotating their binary representations
Given an array arr[] consisting of N positive integers, the task is to find the maximum absolute difference between the sum of the array elements placed at even indices and those at odd indices of the array by rotating their binary representations any number of times. Consider only 8-bit representation. Examples: Input: arr[] = {123, 86, 234, 189}O
12 min read
Sum of decimals that are binary representations of first N natural numbers
Given a positive integer N, the task is to calculate the sum of all decimals which can be expressed as binary representations of first N natural numbers. Examples: Input: N = 3Output: 22Explanation:The Binary Representation of 1 is 01.The Binary Representation of 2 is 10.The Binary Representation of 3 is 11.Therefore, required sum = 01 + 10 + 11 =
9 min read
Consensus Theorem in Digital Logic
Prerequisite - Properties of Boolean algebra, Minimization of Boolean Functions Redundancy theorem is used as a Boolean algebra trick in Digital Electronics. It is also known as Consensus Theorem: AB + A'C + BC = AB + A'C The consensus or resolvent of the terms AB and A'C is BC. It is the conjunction of all the unique literals of the terms, excludi
3 min read
Variable Entrant Map (VEM) in Digital Logic
Prerequisite - Karnaugh Map (K-map) K-map is the best manual technique to solve Boolean equations, but it becomes difficult to manage when number of variables exceed 5 or 6. So, a technique called Variable Entrant Map (VEM) is used to increase the effective size of k-map. It allows a smaller map to handle large number of variables. This is done by
3 min read
Static Hazards in Digital Logic
A hazard, if exists, in a digital circuit causes a temporary fluctuation in the output of the circuit. In other words, a hazard in a digital circuit is a temporary disturbance in the ideal operation of the circuit which if given some time, gets resolved itself. These disturbances or fluctuations occur when different paths from the input to output h
4 min read
Ring Counter in Digital Logic
A ring counter is a typical application of the Shift register. The ring counter is almost the same as the shift counter. The only change is that the output of the last flip-flop is connected to the input of the first flip-flop in the case of the ring counter but in the case of the shift register it is taken as output. Except for this, all the other
3 min read
5 variable K-Map in Digital Logic
Prerequisite - Implicant in K-Map Karnaugh Map or K-Map is an alternative way to write a truth table and is used for the simplification of Boolean Expressions. So far we are familiar with 3 variable K-Map & 4 variable K-Map. Now, let us discuss the 5-variable K-Map in detail. Any Boolean Expression or Function comprising of 5 variables can be s
5 min read
Self Dual functions in Digital Logic
A function is said to be Self dual if and only if its dual is equivalent to the given function, i.e., if a given function is f(X, Y, Z) = (XY + YZ + ZX) then its dual is, fd(X, Y, Z) = (X + Y).(Y + Z).(Z + X) (fd = dual of the given function) = (XY + YZ + ZX), it is equivalent to the given function. So function is self dual. In a dual function: AND
2 min read
Adders and Subtractors in Digital Logic
Subtraction of two binary numbers can be accomplished by adding 2's complement of the subtrahend to the minuend and disregarding the final carry if any. If the MSB bit in the result of addition is a '0'. then the result of addition is the correct answer. If the MSB bit is a '1'. , this implies that the answer has a negative sign. The true magnitude
4 min read
Array Multiplier in Digital Logic
An array multiplier is a digital combinational circuit used for multiplying two binary numbers by employing an array of full adders and half adders. This array is used for the nearly simultaneous addition of the various product terms involved. To form the various product terms, an array of AND gates is used before the Adder array. Checking the bits
3 min read
Logic Synthesis in Digital Electronics
The process of resolving into component parts or analyzing, interpreting, translating, optimizing (rearranging or rewriting to improve efficiency), and mapping RTL (Register Transfer Level) code into a particular and indicated cell library. Programmed production of logic components in a specific digital circuit which may involve various kinds of co
5 min read
List of “Difference Between” Digital Logic and Design Topics
Digital Logic and Design are the main part of ultramodern electronic systems which enable the structure of complex circuits that power our world of digital and technology. This is a system in computers that uses simple values to produce I/ O operations. These distinctions include sense gates, circuit designs, and design approaches, and They have a
4 min read
Wired Logic in Digital Electronics
Wired logic is a type of digital logic where some logic operations are carried out by directly coupling the outputs of a single or several logic gates. This approach is determined by the electrical properties of the gates involved. A logic gate that uses just passive components like diodes and resistors to implement boolean algebra is known as a wi
4 min read
What is Digital Logic ?
Modern computing system consists of complex system and technologies. These technologies are built upon some fundamental simple logics known as digital logic. By using digital logic gates we can develop complex logical circuit for various purposes like data storing, data manipulation or simply data representation. What is Digital Logic?One of the mo
2 min read
Ripple Counter in Digital Logic
Counters play a crucial role in digital logic circuits, enabling tasks such as clock frequency division and sequencing. This article explores the concept of ripple counters, a type of asynchronous counter, their operation, advantages, and disadvantages in digital logic design. What is a Counter?Counter is basically used to count the number of clock
5 min read
Counters in Digital Logic
A Counter is a device which stores (and sometimes displays) the number of times a particular event or process has occurred, often in relationship to a clock signal. Counters are used in digital electronics for counting purpose, they can count specific event happening in the circuit. For example, in UP counter a counter increases count for every ris
4 min read
Synchronous Sequential Circuits in Digital Logic
Synchronous sequential circuits are digital circuits that use clock signals to determine the timing of their operations. They are commonly used in digital systems to implement timers, counters, and memory elements. In a synchronous sequential circuit, the state of the circuit changes only on the rising or falling edge of the clock signal, and all c
4 min read
Digital Logic and Design - GATE CSE Previous Year Questions
Solving GATE Previous Year's Questions (PYQs) not only clears the concepts but also helps to gain flexibility, speed, accuracy, and understanding of the level of questions generally asked in the GATE exam, and that eventually helps you to gain good marks in the examination. Previous Year Questions help a candidate practice and revise for GATE, whic
4 min read
Digital Logic Design - Quiz Questions
Digital Logic Design is an important part in the field of Electrical and Electronics Engineering. Mastering this subject requires not only good theory knowledge but also learning practical applications. This Digital Logic Design Quiz is designed to test your fundamental understanding of Digital Logic Design. The quiz covers a wide range of topics r
15+ min read
Difference between SOP and POS in Digital Logic
In digital logic, the inputs and output of a function are in the form of binary numbers (Boolean values) i.e., the values are either zero (0) or one (1). Therefore, digital logic is also known as 'Boolean logic'. These inputs and output can be termed as 'Boolean Variables'. The output Boolean variable of a digital signal can be expressed in terms o
5 min read
Latches in Digital Logic
Latch is a digital circuit which converts its output according to its inputs instantly. To implement latches, we use different logic gates. In this article, we will see the definition of latches, latch types like SR, gated SR, D, gated D, JK and T with its truth table and diagrams and advantages and disadvantages of latch. Table of Content What are
7 min read
Encoders and Decoders in Digital Logic
Binary code of N digits can be used to store 2N distinct elements of coded information. This is what encoders and decoders are used for. Encoders convert 2N lines of input into a code of N bits and Decoders decode the N bits into 2N lines. 1. Encoders - An encoder is a combinational circuit that converts binary information in the form of a 2N input
4 min read