The Gateway to Computer Science Excellence
+26 votes
3.3k views

Consider the following $32-bit$ floating-point representation scheme as shown in the format below. A value is specified by $3$ fields, a one bit sign field (with $0$ for positive and $1$ for negative values), a $24 bit$ fraction field (with the binary point is at the left end of the fraction bits), and a $7 bit$ exponent field (in $excess-64$ signed integer representation, with $16$ is the base of exponentiation). The sign bit is the most significant bit.

  1. It is required to represent the decimal value $- 7.5$ as a normalized floating point number in the given format. Derive the values of the various fields. Express your final answer in the hexadecimal.
  2. What is the largest value that can be represented using this format? Express your answer as the nearest power of $10$.
in Digital Logic by Veteran (52.2k points)
edited by | 3.3k views
+1
Arjun Sir ,

Is it necessary for the MSB of the Mantissa to be non zero in Normalized Form ?
0
yes, in binary it must always be '1'. But IEEE 754 format hides this one and not explicitly represent this for normalized numbers.
+1

Sir, 

But then when you converted 111.1 * 16^0 to 0.0111*16^1 

0.0111*16^1 , is not in Normalized Form  ( and the question says we want it in Normalized Form)

 the defination of Normalised Number  -

A number in Scientific Notation with no leading 0s is called a Normalised Number: 1.0 × 10-8 

where am I going wrong ?

0
The given ans in part 1 is not in normalized form.

(0.01111000...) * (16^1).

(0.0000011110...) * (16^2).

both these have the same decimal value which is 15 / 4.
0

Not being able to understand part b) answer. The calculation part which results into 1076 and why 224 is subtracted from 1. Please help.

+9

Re-writing the same answer as that of Arjun Sir (correct me if I am wrong anywhere)

The Floating point representation given in the question is not that of IEEE-754. The equation of the given representation is:

$0.M X 2^{Exponent-Base}$

The 0 in 0.M is not implicit, but explicit

Now, given number -7.5

$(-7.5)_{10} = (-111.1)_{2} = -0.1111 * 2^{3} \rightarrow\left[1\right]$

Now, base is given as 16 with excess 64, that is

$16^{x-64} = 2^{4(x-64)} = 2^{4x-256} \rightarrow\left[2\right]$

Here, x is the exponent. Now from equation 1 and 2, we get

$4x-256=3$

$x\approx 65$

Now, equation 1 becomes:

$-0.1111 * 2^{65-64}$

This gives S=1, M = 011110000000000000000000 and E = 1000001

$(1\; 01111\underbrace{000\dots0}_{\text{19 zeroes}} \; 1000001)_2 = (BC000041)_{16}$

+1

Hemant Parihar

Is it possible to represent part a  in normalized form ?

0

@rishi71662data4 in the last part, equation 1 becomes $-0.1111 * 16^{65 - 64}$ right?

4 Answers

+26 votes
Best answer

Here, mantissa is represented in normalized representation and exponent in excess-64 (subtract 64 to get actual value). 

a. We have to represent $-(7.5)_{10} = -(111.1)_2$. 

Now we are using base 16 for exponent. So, mantissa will be .01111  and this makes exponent as 1 (4 bit positions and no hiding first 1 as in IEEE 754 as this is not mentioned in question) which in excess-64 will be 64 + 1 = 65. Number being negative sign bit is 1. So, we get

$(1\; 01111\underbrace{000\dots0}_{\text{19 zeroes}} \; 1000001)_2 = (BC000041)_{16}$

b. Largest value will be with largest possible mantissa, largest possible exponent and positive sign bit. So, this will be all 1's except sign bit which will be 

$0.\underbrace{111\dots 1}_{\text{24 ones}} \times 16^{127-64} = \left( 1 - 2^{24}\right) \times 16^{63} = \left(1- 2^{-24}\right) \times 16^{63}$

(Again we did not add implicit 1 as in IEEE 754)

$2^x = 10^{y} \implies y = \log 2^x = x \log 2$  

So, $(1-2^{-24}) \times 16^{63} \\= \left(1 - 10^{-24 \log 2}\right) \times 10^{63 \log 16}\\ \approx \left(1 - 10^{-7}\right) \times 10^{76}\\ = 10^{76}$
 

Not directly relevant here, but a useful read: https://jeapostrophe.github.io/courses/2015/fall/305/notes/dist/reading/help-floating-point.pdf

by Veteran (424k points)
selected by
+1

"Now we are using base 16 for exponent. So, mantissa will be .01111  and this makes exponent as 1 "

please explain how using base 16 for exponent get us to .01111?

we have only changed the exponent not the base here ??

0

G.K.T 

 The MSB of the Mantissa is non zero in Normalized Form , in binary form it must always be '1' . This ' 1 ' is implicit  in IEEE - 754 representation.

0
Thank you bikram sir.It is clear now
0

But sir my question was how (111.1)2 become (0.01111)16

why decimal point is shifted 4 points left ?

0

G.K.T

Because in base 16, 4 bits are used to represent each Byte.

Each byte is shown as a pair of nibbles (4 bits) .

+2

This is what I got from your answer please verify

111.1 x 20

11.11 x 21

1.111 x 22

0.1111 x 23

0.01111 x 24  that is same as 0.01111 x 16

and as you have already mentioned above that in IEEE 754 msb 1 is implicit so thats why we aren't mentioning in the representation

0

@Arjun sir and bikram sir

In ques https://gateoverflow.in/2729/gate1996_1-25

we have used first bit after decimal as 1 because it was normalized form but not IEEE.And same is the case here.So why in current question we are able to store fraction as .0111 as normalized form with first bit after decimal as 0

0
@rahul what will be the answer is first bit after "." is made 1 here?
+1
Sir if i try to make first bit after decimal as 1,then i am not able to adjust getting exponent as base 16

111.1 * 16^0

=.1111 *16^0*2^3, but if i do one more right shift as in the answer ,then we can get 16^1 ,but is'nt is required in normalized form to have first bit of mantissa as 1?
+1
@rahul

" The leading bit of mantissa is  1 ( this 1 is implicit  in IEEE representation) "

but it is only normalized representation, that is why it differs

but without MSB bit 1 how a number can be normalized? that is question for me too
0

all steps are  correct but final answer will be approximately  7 *1075

we can not write it as 10^76

because 10^76 - 7*10^75= 3 *10^75 .......so huge difference

+1
How the leading bit is 1?. The mantissa is given as 0.0111 ,actually no should be 1.111*2 power 2
0
For B part, are we allowed to put all 1's in Exponent field? because it is special case.
0

So I have read all the comments and understood the Part A answer. But when this answer is converted to decimal, we don't get -7.5. Mantissa is .01111 and unbiased exponent is 1. Now it is given in the question that the floating point number is normalized. Hence the number is 1.01111 * 16^1 (with sign bit as 1). But this number is not equal to -7.5. Now 7.5 in binary is 111.1 . If we want to keep this number normalized, we must have a 1 before the binary point. We have 1.111 * 2^2 = 1.111 * 16^(0.5). Biased exponent is 64.5 which I think cannot be expressed. What am I doing wrong? Please help @Arjun sir @Bikram sir @Akash Kanase sir

0
0
+10 votes
It is clearly given here that this is excess 64 & Base is 16. So we need to use that.

a)

-7.5 Due to minus sign we will get sing bit as 1.

7.5 = 111.1 * 16^0

As Base is 16 & We need to normalize we need to at least normalize to 16^1. (This answer maybe different if we choose not to normalize, Though I think we can not use either implicit or explicit normalization correctly here.

It will be 0.0111*16^1.

So now our biased exponent is 1+64 = 65.

Mantissa is (0.) 0111000...

When we save it we get hex as BC000041

 

2. Maximum value possible is $(1- 2^{-24}) \times 16^{(127-64)}$.

WHen converted into base 10 we get $7.237006 \times 10^{75}$.
by Boss (41.5k points)
edited by
0
Hi. I'm confused here . Why aren't you taking the number : 1.1111...1(24 1s)*16^63=(2-2^-24)*16^63 ?

You are taking 0.(24 1s) , which is why you got (1-2^-24) ; confused here :\ please reply
0
7.5 = 111.1 * 16^0
how did u get dis...plzz explain... m not able 2
understand d solution ..
0
Maximum value possible is (1−2−24)×16(127−64).

WHen converted into base 10 we get 7.237006×1075.
plzz xplain dis part...
0

As Base is 16 & We need to normalize we need to at least normalize to 16^1

Why? Why can't we keep it as 16^0 itself? 0 is a valid exponent right?

0

@Sambhrant Maurya  yes 0 is a valid exponent but mantissa is represented as M in 0.M , that's why we do normalization.

Normalized form is $(-1)^S (0.M)\times 16^{E-64}$

+1 vote
a) 7 bit exponent means biasing of = 2^(7-1) -1 = 63

-7.5= - 111.1 =- 1.111 * 2^2

sign bit =1

biased exponent = 65 as (65 - 63 = 2) = 0010001

fraction = 111000000000000000000000 (three 1s followed by twenty one 0s)

normalized representation = 1 111000000000000000000000 0010001

hexadecimal representation = F0000011

b) largest value :

sign bit = 0 (positive)

exponent = 1111110

fraction = 111111111111111111111111 ( twenty four 1s )

normalized number =  0 111111111111111111111111 1111110

= 2147483646

= 2.147483646 * 10^9

 

CORRECT ME IF I AM WRONG
by Active (4.1k points)
+1
for 7 bit the biasing is 64 don't know why i saw this in many answers!!!

BTW..65 binary is 1000001 which brings ur answer to F0000041

if we use 64 biasing i am getting F0000042

can some confirm which biasing to use??

for part b)

the mantissa will look like

1.1...24 1's...1 which is 2.16777215

exponent will be (126-64 or 63) (say 126-64 = 62)

so..=2.16777215 X 10^62

correct me also if wrong :)
0 votes

First express (-7.5) into binary

How to write (-7.5) in binary

first write 7.5 into binary = (111.1)

Do not worry about negative sign here sign bit will contain 1 because above number is negative.

And base 16 is given hence we will convert into power of 16(we know 2^4=16)

So we can write 111.1*2^0 = 0.01111*2^4

0.01111*2^4 = 0.01111*16^1( here 16 is a base and 1 is exponent)

Excess 64 is given hence 1+64=65

65 in binary= 1000001(we will represent 65 in exponent field)

Now we have to represent into floating point

Sign bit = 1

Mantissa = 011110...0(19 zero consecutive)

Exponent = 1000001 

( 1  011110....0   1000001 ) in floating point

convert it into hexadecimal and make a pair of 4 digit from right side. ( for example 0001=1 in hexadecimal )

then you will get (BC000041) in hexadecimal

 

by Junior (621 points)
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,647 questions
56,459 answers
195,378 comments
100,274 users