floating point to fixed point conversion

R

riya1012

hello guys,

I need some help from you. I am doing a DSP project and for that I need
to do some C coding for the conversion of sample data which is in
floating point representation to fixed point representation.
the sample data is in floating point like
0.224128
2.299965
0.448350
-1.779926
My DSP algorithm is implemented in C and is supposed to be using fixed
point representation.
The above data is intended to be converted to fixed integer format.I
request you to help me out regarding this conversion.I will be very
glad if u give me some hints or algorithms for this conversion.
 
G

Grumble

I need some help from you. I am doing a DSP project and for that I need
to do some C coding for the conversion of sample data which is in
floating point representation to fixed point representation.
the sample data is in floating point like
0.224128
2.299965
0.448350
-1.779926
My DSP algorithm is implemented in C and is supposed to be using fixed
point representation.
The above data is intended to be converted to fixed integer format.I
request you to help me out regarding this conversion.I will be very
glad if u give me some hints or algorithms for this conversion.

Well, you've already asked in comp.dsp and comp.arch.embedded

Newsgroups: comp.dsp
Subject: floating point to fixed point conversion
Date: 21 Feb 2006 14:12:58 -0800
Message-ID: <[email protected]>

Newsgroups: comp.arch.embedded
Subject: floating point to fixed point conversion
Date: 21 Feb 2006 14:29:45 -0800
Message-ID: <[email protected]>

You should learn to cross-post and set a followup-to.
 
R

Rod Pemberton

hello guys,

I need some help from you. I am doing a DSP project and for that I need
to do some C coding for the conversion of sample data which is in
floating point representation to fixed point representation.
the sample data is in floating point like
0.224128
2.299965
0.448350
-1.779926
My DSP algorithm is implemented in C and is supposed to be using fixed
point representation.
The above data is intended to be converted to fixed integer format.I
request you to help me out regarding this conversion.I will be very
glad if u give me some hints or algorithms for this conversion.

Most can probably help you with scaling the data, but few can help with the
FFTs etc. You'll need to provide more information about your compiler and
the data. What is the range of the floating point data? What are the sizes
of long long, long, short, char, etc., of your compiler. If the range of
the floating point data is highly limited, you could just multiply by 100,
10000, etc. If the range is very wide, then you'll need large integers
64-bits in size which might be 'long long' for your compiler. Perhaps
provide a small piece of code showing what you are thinking or experimenting
with.


Rod Pemberton
 
S

suresh

hello guys,

I need some help from you. I am doing a DSP project and for that I need
to do some C coding for the conversion of sample data which is in
floating point representation to fixed point representation.
the sample data is in floating point like
0.224128
2.299965
0.448350
-1.779926
My DSP algorithm is implemented in C and is supposed to be using fixed
point representation.
The above data is intended to be converted to fixed integer format.I
request you to help me out regarding this conversion.I will be very
glad if u give me some hints or algorithms for this conversion.

What is the precision of your fixed point number?

Let us say it is 2 ^ (-N), then all that you need to do is

long conv_to_fixed(float f)
{
return f * _2_power_N;
}

For example if you need 1/256 precision (x.8 format) then

return f * 256.
 
D

Default User

Well, you've already asked in comp.dsp and comp.arch.embedded
You should learn to cross-post and set a followup-to.

Yes and no. If a post really needs to be seen by more than one group
(seldom is this really true) then cross-posting is correct. However,
setting follow-ups is, in my opinion, rude. What, you expect people to
go and subscribe to a new group to follow the thread? If the original
question was topical for the newsgroup, then so are the replies.

Follow-ups are only (again my opinion) proper for redirections.



Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top