The Wayback Machine - https://web.archive.org/web/20241013190135/https://www.geeksforgeeks.org/introduction-of-floating-point-representation/
Open In App

Introduction of Floating Point Representation

Last Updated : 17 May, 2023
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

1. To convert the floating point into decimal, we have 3 elements in a 32-bit floating point representation: 
    i) Sign 
    ii) Exponent 
    iii) Mantissa 

 

  • Sign bit is the first bit of the binary representation. ‘1’ implies negative number and ‘0’ implies positive number. 
    Example: 11000001110100000000000000000000 This is negative number.
  • Exponent is decided by the next 8 bits of binary representation. 127 is the unique number for 32 bit floating point representation. It is known as bias. It is determined by 2k-1 -1 where ‘k’ is the number of bits in exponent field. 

    There are 3 exponent bits in 8-bit representation and 8 exponent bits in 32-bit representation.

    Thus

    bias = 3 for 8 bit conversion (23-1 -1 = 4-1 = 3) 
    bias = 127 for 32 bit conversion. (28-1 -1 = 128-1 = 127) 

    Example: 01000001110100000000000000000000 
    10000011 = (131)10 
    131-127 = 4 

    Hence the exponent of 2 will be 4 i.e. 24 = 16.

  • Mantissa is calculated from the remaining 23 bits of the binary representation. It consists of ‘1’ and a fractional part which is determined by: 

    Example: 

    01000001110100000000000000000000 

    The fractional part of mantissa is given by: 

    1*(1/2) + 0*(1/4) + 1*(1/8) + 0*(1/16) +……… = 0.625 

    Thus the mantissa will be 1 + 0.625 = 1.625 

    The decimal number hence given as: Sign*Exponent*Mantissa = (-1)0*(16)*(1.625) = 26

2. To convert the decimal into floating point, we have 3 elements in a 32-bit floating point representation: 
    i) Sign (MSB) 
    ii) Exponent (8 bits after MSB) 
    iii) Mantissa (Remaining 23 bits) 
 

  • Sign bit is the first bit of the binary representation. ‘1’ implies negative number and ‘0’ implies positive number. 
    Example: To convert -17 into 32-bit floating point representation Sign bit = 1
  • Exponent is decided by the nearest smaller or equal to 2n number. For 17, 16 is the nearest 2n. Hence the exponent of 2 will be 4 since 24 = 16. 127 is the unique number for 32 bit floating point representation. It is known as bias. It is determined by 2k-1 -1 where ‘k’ is the number of bits in exponent field. 

    Thus bias = 127 for 32 bit. (28-1 -1 = 128-1 = 127) 

    Now, 127 + 4 = 131 i.e. 10000011 in binary representation.

  • Mantissa: 17 in binary = 10001.

    Move the binary point so that there is only one bit from the left. Adjust the exponent of 2 so that the value does not change. This is normalizing the number. 1.0001 x 24. Now, consider the fractional part and represented as 23 bits by adding zeros.

    00010000000000000000000

 

Advantages:

Wide range of values: Floating factor illustration lets in for a extensive variety of values to be represented, along with very massive and really small numbers.

Precision: Floating factor illustration offers excessive precision, that is important for medical and engineering calculations.

Compatibility: Floating point illustration is extensively used in computer structures, making it well matched with a extensive variety of software and hardware.

Easy to use: Most programming languages offer integrated guide for floating factor illustration, making it smooth to use and control in laptop programs.

Disadvantages:

Complexity: Floating factor illustration is complex and can be tough to understand, mainly for folks that aren’t acquainted with the underlying mathematics.

Rounding errors: Floating factor illustration can result in rounding mistakes, where the real price of a number of is barely extraordinary from its illustration inside the computer.

Speed: Floating factor operations can be slower than integer operations, particularly on older or much less powerful hardware.

Limited precision: Despite its excessive precision, floating factor representation has a restrained number of sizeable digits, which could restrict its usefulness in some programs.

Related Link: 
https://www.youtube.com/watch?v=03fhijH6e2w

More questions on number representation: 
https://www.geeksforgeeks.org/number-representation-gq/ 

This article is contributed by Kriti Kushwaha

 

 


Previous Article
Next Article

Similar Reads

Floating Point Representation - Basics
There are posts on representation of floating point format. The objective of this article is to provide a brief introduction to floating point format. The following description explains terminology and primary details of IEEE 754 binary floating-point representation. The discussion confines to single and double precision formats. Usually, a real nu
10 min read
IEEE Standard 754 Floating Point Numbers
The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard for floating-point computation which was established in 1985 by the Institute of Electrical and Electronics Engineers (IEEE). The standard addressed many problems found in the diverse floating point implementations that made them difficult to use reliably and reduced
5 min read
Multiplying Floating Point Numbers
Prerequisite - IEEE Standard 754 Floating Point Numbers Problem:- Here, we have discussed an algorithm to multiply two floating point numbers, x and y. Algorithm:- Convert these numbers in scientific notation, so that we can explicitly represent hidden 1. Let ‘a’ be the exponent of x and ‘b’ be the exponent of y. Assume resulting exponent c = a+b.
2 min read
Fixed Point Representation
Fixed Point Representation means that represents real numbers in a computer system, where the position of the decimal of the (or binary) point is fixed. This is in difference to floating point representation, where the position of the point can "float." In fixed point representation, the number is split into an integer part and a fractional part. R
7 min read
Representation of Negative Binary Numbers
Since binary numbers can have only two symbols either 0 or 1 for each position or bit, so it is not possible to add minus or plus symbols in front of a binary number. We represent negative decimal numbers using a minus symbol in front of them. In computer number representation, these numbers can be distinguishable with the help of an extra bit or f
3 min read
Representation of Boolean Functions
Boolean functions are expressions involving Boolean variables and operators, such as AND, OR, and NOT. These functions are fundamental in digital logic design, computer science, and engineering. Table of Content What are Boolean Functions?Definition of Boolean FunctionsRepresentation of Boolean FunctionsDifferent representations of a Boolean functi
10 min read
Introduction to Digital Systems
A system is a set of related components that work as a whole to achieve a goal. A system contains inputs, behavior and outputs. Behavior is a function that translates inputs to output. Components are electronics blocks - digital, analog, or mixed signal. Digital System is a system in which signals have a finite number of discrete values. Analog Sys
1 min read
Introduction of LED
There are various sources of light, like candles, lamps, etc. Light bulb was invented by Thomas Edison in 1879. Light Emitting Diodes (LED), electronic electrical energy can directly convert into light energy. You can find LEDs in Cars, Bikes, Street Lights, Home Lighting, Office Lighting, Mobile Phones, Televisions and many more. Light is an energ
2 min read
Introduction of BioChip
Biochip is a miniature version of a laboratory, using which more than hundreds of biochemical reactions take place simultaneously. They are specially designed for functioning in a biological environment, especially inside living organisms. It is not an electronic device. Biochips consist of millions of biosensors, which acts as microreactor used fo
4 min read
Introduction of Blue Brain (world's first Artificial Brain)
Artificial Brain is a software or hardware which is similar to functioning of biological human brain in terms of Memory, Feelings, Emotions, and decision making. This can be done using reverse engineering techniques on human brain so functioning of brain can be understood. The structure of human brain is still complex to understand by scientists. M
3 min read
Introduction of Foldable Screens
Foldable screens, once thought to be impossible, but in today’s era nothing seems to be impossible and these foldable screens are a reality in form of foldable phones. This phone becomes a tablet when opened and a pocket-sized smart-phone when folded. But, question is how they achieved such a technological feat. Well, answer is flexible screens; it
3 min read
Introduction of Algorithmic State Machines (ASMs)
Introduction : In digital systems, the binary information is divided into data and control information.Data information is manipulated by various operations like arithmetic, shift, and logic. These operations are implemented by multiplexers, decoders, counters, and shift registers.Control information gives various command signals that help to perfo
4 min read
Introduction of Asynchronous SRAM
The RAM,i.e Random Access Memory is a primary source of data storing memory device for the computers. This memory is available in 2 forms, named as - SRAM(Static RAM)DRAM(Dynamic RAM) Whereas the SRAM is also divided broadly into 2 forms, those are - Synchronous SRAMAsynchronous SRAM In this article, we will study what is Asynchronous SRAM. A thing
3 min read
Introduction of K-Map (Karnaugh Map)
In many digital circuits and practical problems, we need to find expressions with minimum variables. We can minimize Boolean expressions of 3, 4 variables very easily using K-map without using any Boolean algebra theorems. K-map can take two forms: Sum of product (SOP) Product of Sum (POS) According to the need of problem. K-map is a table-like rep
3 min read
Introduction to logic family
In this article, We will be going through the Logic Family. we will start our article with an introduction to the logic families, then we will go through their classification and go through their characteristics. Also, we will go through the comparison between CMOS, TTL, and ECL logic families. At last, we will conclude our article with the advanta
14 min read
Introduction to memory and memory units
Memory is required to save data and instructions. Memory is divided into cells, and they are stored in the storage space present in the computer. Every cell has its unique location/address. Memory is very essential for a computer as this is the way it becomes somewhat more similar to a human brain. In this article, we are going to discuss memory an
11 min read
Introduction to Clampers
Clamper circuits are essential in electronic circuits because they allow signals to be changed in voltage levels without altering the shape of their waveforms. These circuits are used in many different contexts, such as voltage regulation and signal processing, to modify the location of the signal. What is a Clamper?A Clamper circuit is designed to
5 min read
Introduction to Clippers
A clipper in electronics is a circuit created to stop a signal from going over a specific reference voltage level. The remaining portion of the waveform that is applied is not distorted by a clipper. The clipping of a portion of a wave from an input signal is done with Clipper Circuits. A diode is the main component, and it can be used in series or
14 min read
Introduction of Logic Gates
In Boolean Algebra, there are three basic operations, [Tex] +,\:.\:,\:^\prime [/Tex] which are analogous to disjunction, conjunction, and negation in propositional logic . Each of these operations has a corresponding logic gate. Apart from these, there are a few other logic gates as well. It was invented by George Boole. Table of Content What is a
10 min read
Introduction of Sequential Circuits
Sequential circuits are digital circuits that store and use the previous state information to determine their next state. Unlike combinational circuits, which only depend on the current input values to produce outputs, sequential circuits depend on both the current inputs and the previous state stored in memory elements. Sequential CircuitSequentia
8 min read
SR Flip Flop
In this article, we will go through SR Flip Flop, we will start our article with the definition and construction of the flip-flip, and then we will go through its Basic Block Diagram with its working and characteristic block diagram, at last, we will conclude our article with its applications. Table of Content SR Flip FlopConstruction Basic Block D
6 min read
Boolean Algebra
Boolean algebra is a type of algebra that is created by operating the binary system. In the year 1854, George Boole, an English mathematician, proposed this algebra. This is a variant of Aristotle's propositional logic that uses the symbols 0 and 1, or True and False. Boolean algebra is concerned with binary variables and logic operations. Boolean
14 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
Encoder in Digital Logic
An encoder is a digital circuit that converts a set of binary inputs into a unique binary code. The binary code represents the position of the input and is used to identify the specific input that is active. Encoders are commonly used in digital systems to convert a parallel set of inputs into a serial code. The basic principle of an encoder is to
7 min read
Full Subtractor in Digital Logic
A full subtractor is a combinational circuit that performs subtraction of two bits, one is minuend and other is subtrahend, taking into account borrow of the previous adjacent lower minuend bit. This circuit has three inputs and two outputs. The three inputs A, B and Bin, denote the minuend, subtrahend, and previous borrow, respectively. The two ou
3 min read
Program for Decimal to Binary Conversion
Given a decimal number as input, we need to write a program to convert the given decimal number into an equivalent binary number. Examples of Decimal to Binary:  Input : 7Output : 111Input : 10Output : 1010Input: 33Output: 100001Recommended PracticeDecimal to binaryTry It!Brute force ApproachFor Example: If the decimal number is 10. Step 1: Remaind
15+ min read
Full Adder in Digital Logic
Full Adder is the adder that adds three inputs and produces two outputs. The first two inputs are A and B and the third input is an input carry as C-IN. The output carry is designated as C-OUT and the normal output is designated as S which is SUM. The C-OUT is also known as the majority 1's detector, whose output goes high when more than one input
5 min read
Multiplexers in Digital Logic
In this article we will go through the multiplexer, we will first define what is a multiplexer then we will go through its types which are 2x1 and 4x1, then we will go through the Implementation of the 2x1 mux and higher mux with lower order mux, At last we will conclude our article with some applications, advantages and some FAQs. Table of Content
11 min read
Flip-Flop types, their Conversion and Applications
In this article, we will go through the Flip-Flop types, their Conversion and their Applications, First, we will go through the definition of the flip-flop with its types in brief, and then we will go through the conversion of the flip-flop with its applications, At last, we will conclude our article with some FAQs. Table of Content Flip-FlopTypes
7 min read
Half Adder in Digital Logic
A half adder is a digital logic circuit that performs binary addition of two single-bit binary numbers. It has two inputs, A and B, and two outputs, SUM and CARRY. The SUM output is the least significant bit (LSB) of the result, while the CARRY output is the most significant bit (MSB) of the result, indicating whether there was a carry-over from th
4 min read
Article Tags :