You are not logged in. Please login at www.codechef.com to post your questions!

×

Bits fractional part

The n - bit fixed point representation of an unsigned real number x uses f bits for the fraction part . Let i= n- f. The range of decimal values for x in this representation is?

asked 13 Feb '18, 09:28

phantomhive's gravatar image

4★phantomhive
944
accept rate: 0%


Since given number is in unsigned bit representation, its decimal value starts with 0. We have i bit in integral part so maximum value will be 2^i Thus integral value will be from 0 to 2^i – 1

We know fraction part of binary representation are calculated as (1/0)*2^-f

Thus with f bit maximum number possible = sum of GP series with a = 1/2 and r = 1/2

Thus fmax = {1/2(1 – (1/2)^f}/(1 – 1/2) = 1 – 2^-f

Thus maximum fractional value possible = 2i – 1 + (1 – 2^-f ) = 2i - 2^-f

Source: https://www.geeksforgeeks.org/gate-gate-cs-2017-set-1-question-32/

link

answered 01 Apr '18, 02:21

raka_iiitg's gravatar image

2★raka_iiitg
1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×77

question asked: 13 Feb '18, 09:28

question was seen: 133 times

last updated: 01 Apr '18, 02:21