473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

floating point to fixed point conversion

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.

Feb 21 '06 #1
4 5801
ri******@gmail.com 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: <11*********************@o13g2000cwo.googlegroups. com>

Newsgroups: comp.arch.embedded
Subject: floating point to fixed point conversion
Date: 21 Feb 2006 14:29:45 -0800
Message-ID: <11**********************@g44g2000cwa.googlegroups .com>

You should learn to cross-post and set a followup-to.
Feb 22 '06 #2

<ri******@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr 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

Feb 22 '06 #3
ri******@gmail.com 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.

Feb 22 '06 #4
Grumble wrote:
ri******@gmail.com 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

Feb 22 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Abe Simpson | last post by:
Hello all, The application I am working on must never output numbers in a floating-point format, that is, something like 2e-002 is a big no-no. At the same time, it must output numbers in a...
9
by: pout | last post by:
What are the purposes of fixed-point? When should it be used? I read: #define Int2Fixed(x) (((long)(short)x) << 16) and the fixed-point in 16.16 format. Does the 16 in the MACRO refer to...
2
by: Pallav | last post by:
I'm trying to convert some source code containing floating point into fixed-point arithmetic. I am having some trouble understanding fixed point signed multiply. I have a 18.14 base integer with...
0
by: pallav | last post by:
is anyone aware of a freely-available C fixed point library for unix/linux systems? i remember about 6-7 months ago, i searched the net and located a project (i'm not sure now if it was open...
1
by: snoop911 | last post by:
Im interfacing to a chip that uses a 16-bit register where bits 13:6 represent the integer portion, and 5:0 the fractional portion. So, my problem is converting from my chip's native floating...
12
by: astri | last post by:
i`m doing my thesis comparing CORDIC with polynomial in counting arctan with fixed point. I`m using Q15 format now. I`m using this site CORDIC arctan as a referenced when making with floating...
0
by: kaushikc | last post by:
I need to design a text-box which will take only Fixed-Point Input which should be rounded upto 2 decimal places i.e. 456.25. And also I have to show 0.00 when there is nothing in the text-box i.e....
9
by: suppamax | last post by:
Hi everybody! I'm writing a C program for a PIC18F microcontroller. I need to calculate a power function, in which both base and exponent are fixed point numbers (ex: 3.15^1.13). Using...
2
by: m.a | last post by:
Hello, Is there any fixed point library in .net framework? I need it to use on fixed point processor that doesn't have any floating point co processor Regards
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.