Sei sulla pagina 1di 5

Custom Search

Write an Article Login

Floating Point Representation | Digital


Logic
1 . To c o n v e r t t h e f l o a t i n g ppooi n t i n t o d e c i m a l , w e h a v ee 3 e l e m e n t s i n a
3 2 - b i t f l o a t i n g p o i n t r e p r eesse n t a t i o n :
i) Sign
ii) Exponent
iii) Mantissa

S i g n bit is the first bit of the binary representation. '1' implies negative
number and '0' implies positive number.
E x a m p l e : 11000001110100000000000000000000 This is negative
number.

E x p o n e n t 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 expo-
nent field.
There are 2 exponent bits in 8-bit representation and 8 exponent bits in
32-bit representation.
Thus
bias = 3 for 8 bit conversion (22-1 -1 = 4-1 = 3)
bias = 127 for 32 bit conversion. (28-1 -1 = 128-1 = 127)

E x a m p l e : 01000001110100000000000000000000
10000011 = (131)2
131-127 = 4

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

M a n t i s s a is calculated from the remaining 24 bits of the binary repre-



sentation. It consists of '1' and a fractional part which is determined by:
Example:
car insurance

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)*(16)*(1.625) = -26

2 . To c o n v e r t t h e d e c i m a l i n t o f l o a t i n g p o i n t , w e h a v ee 3 e l e m e n t s i n a
3 2 - b i t f l o a t i n g p o i n t r e p r eesse n t a t i o n :
i) Sign (MSB)
ii) Exponent (8 bits after MSB)
iii) Mantissa (Remaining 23 bits)

S i g n b i t 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
E x p o n e n t 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.

M a n t i s s a : 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 normaliz-
ing the number. 1.0001 x 24. Now, consider the fractional part and rep-
resented as 23 bits by adding zeros.

00010000000000000000000

Thus the floating point representation of -17 is 1 10000011


00010000000000000000000

Related Link:
https://www.youtube.com/watch?v=03fhijH6e2w
More questions on number representation:
http://quiz.geeksforgeeks.org/number-representation/

This article is contributed by K r i t i K u s h w a h a


Please write comments if you find anything incorrect, or you want to share
more information about the topic discussed above.

Digital Electronics & Logic Design Login to Improve this Article

Please write to us at contribute@geeksforgeeks.org to report any issue with the above


content.

Recommended Posts:

K-Map (Karnaugh Map)


Number System and base conversions | Digital Electronics
Synchronous Sequential Circuits | Digital Logic
Digital Electronics | Half Adder
LMN – Digital Electronics
Restoring Division Algorithm For Unsigned Integer
Amortized analysis for increment in counter
Digital Electronics | Operational Amplifier (op-amp)
Combinational circuits using Decoder
Digital Logic | n-bit Johnson Counter ▲
(Login to Rate)

Average Difficulty : 3 / 5 . 0
3 Based on 3 vote(s)
Add to TODO List
Mark as DONE
Basic Easy Medium Hard Expert

Writing code in comment? Please use ide.geeksforgeeks.org, generate link and


share the link here.

Share this post!

2 Comments GeeksforGeeks 
11 Login

S
Soorrtt bbyy N
Neew
weesstt
R
Reeccoom
mmmeenndd ⤤ SShhaarree

Join the discussion…

LLO
OGG IIN
NWWIITTH
H O
ORRS
SIIG
GNNU
UPPW
WIITTH
HDDIIS
SQQU
USS ??

Name

Manish Prajapati

6 months ago

bias = 3 for 8 bit conversion (22-1 -1 = 4-1 = 3).. this line is not looking correct...
plz correct it..
△ ▽ Reply

Bilash Halder

9 months ago

this content not useful for learn


△ ▽ Reply

✉ SSuubbssccrriibbee d AAdddd DDiissqquuss ttoo yyoouurr ssiitteeAAdddd DDiissqquussAAdddd 🔒 P


Prriivvaaccyy


710-B, Advant Navis Business Park,
Sector-142, Noida, Uttar Pradesh - 201305
feedback@geeksforgeeks.org

C O M PA N Y LEARN
About Us Algorithms
Careers Data Structures
Privacy Policy Languages
Contact Us CS Subjects
Video Tutorials

PRACTICE CONTRIBUTE
Company-wise Write an Article
Topic-wise GBlog
Contests Videos
Subjective Questions

@geeksforgeeks, Some rights reserved

Potrebbero piacerti anche