Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > floating point to fixed point conversion

Reply
Thread Tools

floating point to fixed point conversion

 
 
riya1012@gmail.com
Guest
Posts: n/a
 
      02-21-2006
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.

 
Reply With Quote
 
 
 
 
Grumble
Guest
Posts: n/a
 
      02-22-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> 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: <(E-Mail Removed). com>

Newsgroups: comp.arch.embedded
Subject: floating point to fixed point conversion
Date: 21 Feb 2006 14:29:45 -0800
Message-ID: <(E-Mail Removed) .com>

You should learn to cross-post and set a followup-to.
 
Reply With Quote
 
 
 
 
Rod Pemberton
Guest
Posts: n/a
 
      02-22-2006

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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



 
Reply With Quote
 
suresh
Guest
Posts: n/a
 
      02-22-2006
(E-Mail Removed) wrote:
> 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.

 
Reply With Quote
 
Default User
Guest
Posts: n/a
 
      02-22-2006
Grumble wrote:

> (E-Mail Removed) wrote:
> > 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.


> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
floating point problem... floating indeed :( teeshift Ruby 2 12-01-2006 01:16 AM
converting floating point to fixed point H aka N VHDL 15 03-02-2006 02:26 PM
Fixed/Block Floating Point Arithmetic Support... Satpreet C Programming 1 02-27-2006 07:06 PM
Fixed-point format for floating-point numbers Motaz Saad Java 7 11-05-2005 05:33 PM
Fixed precision floating point and locale facets Roger Leigh C++ 4 11-12-2003 08:56 PM



Advertisments