fixed point - floating point newbie question
CASTalk.com Forum Index CASTalk.com
Discussion of DSP, FPGA, storage and embedded system.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web castalk.com
fixed point - floating point newbie question

 
Post new topic   Reply to topic    CASTalk.com Forum Index -> DSP
Author Message
K.
Guest





Posted: Fri Dec 09, 2005 5:16 pm    Post subject: fixed point - floating point newbie question Reply with quote

hi,

i have e.g. number 1 in floating point and its equivalent of 8192 in
fixed point representation.
what is the connection? how do you calculate this exactly?

another example would be -2.000125721 in floating is -16385 in fixed
point.

please help.

thx
Back to top
Randy Yates
Guest





Posted: Fri Dec 09, 2005 5:16 pm    Post subject: Re: fixed point - floating point newbie question Reply with quote

Hi,

In a nutshell you divide the integer value of (e.g.) 8192 by 2^b,
where b is the "scaling" of the fixed-point value. In your case, b
must be 13 since 2^13 = 8192 and 8192/8192 = 1.0.

In the second example, the scaling of the value is still apparently
13, since -16385/2^13 = -2.00012207, which is approximately equal to
your desired floating-point value of -2.000125721. This is a good
example because you can begin to see the effect of the choice of b on
your results, i.e., that there is an error in the representation, and
that the range of the value you wish to represent dictates the scaling
(so you don't overflow), which in turn dictates the resolution you
will have.

I've been meaning to rewrite this for years since it's so long-winded,
but the following may help:

http://www.digitalsignallabs.com/fp.pdf

--Randy Yates
Back to top
 
Post new topic   Reply to topic    CASTalk.com Forum Index -> DSP All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




VoIP Electronics Powered by phpBB