Reply by Jim Thomas October 11, 20052005-10-11
Bhooshan Iyer wrote:
> I remember a research effort along these > lines at some university under the name FRIDGE(Fixed-point pRogrammIng > DesiGn Environment) Not sure if it ever worked though!
Well, their acronym sure didn't. -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 I thought I was wrong once, but I was mistaken.
Reply by Bhooshan Iyer October 11, 20052005-10-11
Baskar--

>Or...are you looking for C/C++ code that takes as input, code in C/C++
for a
>floating point algorithm and outputs code for the same algorithm in
fixed
>point?? >You won't find any C/C++ code for any of the above 2 problems.
Mmm.. Am not sure if thats true. I remember a research effort along these lines at some university under the name FRIDGE(Fixed-point pRogrammIng DesiGn Environment) Not sure if it ever worked though! OK. Here is a quick google based link(untested by me): http://www.ert.rwth-aachen.de/Projekte/Tools/FRIDGE/fridge.html --Bhooshan This message was sent using the Comp.DSP web interface on www.DSPRelated.com
Reply by Steve Pope October 11, 20052005-10-11
vutruong <vuttruong@yahoo.com> wrote:

>It seems that I didn't describe my issue clearly. > >My work is to remove the floating-point. My project is written in C >language. And there are some simple operations: addition, subtraction, >multiplication, division and exponent. I think I will make a fixed-point >library with these simple operations. I read some papers about fixed-point >but they are difficult for me to implement the operations in my library. My >project after removing floating-point will use 16 bits to present a >number. > >Thanks for your helps,
Have you considered using System C? Its libraries define fixed-point types that are quire flexible and can certainly do what you want. Usually they are pretty fast also. Steve
Reply by October 11, 20052005-10-11
I know Jerry.
I understood your point, but I just couldn't resist. :)

Luiz Carlos

Reply by vutruong October 11, 20052005-10-11
Hi,

It seems that I didn't describe my issue clearly.

My work is to remove the floating-point. My project is written in C
language. And there are some simple operations: addition, subtraction,
multiplication, division and exponent. I think I will make a fixed-point
library with these simple operations. I read some papers about fixed-point
but they are difficult for me to implement the operations in my library. My
project after removing floating-point will use 16 bits to present a
number.

Thanks for your helps,
Vu
		
This message was sent using the Comp.DSP web interface on
www.DSPRelated.com
Reply by Bhaskar Thiagarajan October 10, 20052005-10-10
"Jerry Avins" <jya@ieee.org> wrote in message
news:JJSdnaaFOfOINtfenZ2dnUVZ_s2dnZ2d@rcn.net...
> Bhaskar Thiagarajan wrote: > > ... > > > I'm not sure I understand your problem based on your post. If I
interpret it
> > in a simple fashion I'd say that this following snippet should do what
you
> > want... > > > > float in_data; > > int fix_data_16; > > > > fix_data_16 = ((int) in_data) & 0xFFFF; > > > > You can get a little more fancy and add some rounding to this if you > > want...but I'd say this converts "floating-point to fixed-point with 16 > > bit-length". > > ... > > What is wanted in conversion to fixed point, not integer. Converting a > floating-point algorithm to fixed point needs a lot more thought than > just converting the numbers.
Which is what I was trying to illustrate...that firstly the question needs to be more precise (even though we can *guess* what he/she wants) and it is a lot more involved that trying to get cookbook answers/code.
> Jerry > -- > Engineering is the art of making what you want from things you can get. > &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Reply by Jerry Avins October 10, 20052005-10-10
oen_no_spam@yahoo.com.br wrote:
>>What is wanted in conversion to fixed point, not integer. Converting a >>floating-point algorithm to fixed point needs a lot more thought than >>just converting the numbers. >> >>Jerry > > > C'mon Jerry, > > Integer is a kind of fixed point! In this case, 16.0.
I will give you good odds that it is not the kind of fixed point that the OP wants. What will you bet? What's more, the conversion of numbers is not the difficulty that prompted his question. (Another bet?) Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Reply by October 10, 20052005-10-10
> What is wanted in conversion to fixed point, not integer. Converting a > floating-point algorithm to fixed point needs a lot more thought than > just converting the numbers. > > Jerry
C'mon Jerry, Integer is a kind of fixed point! In this case, 16.0. Luiz Carlos
Reply by Jerry Avins October 10, 20052005-10-10
Bhaskar Thiagarajan wrote:

   ...

> I'm not sure I understand your problem based on your post. If I interpret it > in a simple fashion I'd say that this following snippet should do what you > want... > > float in_data; > int fix_data_16; > > fix_data_16 = ((int) in_data) & 0xFFFF; > > You can get a little more fancy and add some rounding to this if you > want...but I'd say this converts "floating-point to fixed-point with 16 > bit-length".
... What is wanted in conversion to fixed point, not integer. Converting a floating-point algorithm to fixed point needs a lot more thought than just converting the numbers. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Reply by Bhaskar Thiagarajan October 10, 20052005-10-10
"vutruong" <vuttruong@yahoo.com> wrote in message
news:V92dnc56EbwP_tfeRVn-pg@giganews.com...
> Hi, > > I have to use C/C++ to convert the floating-point to fixed-point with 16 > bit-length. I am looking for algorithm and samples in C/C++ which show how > to solve this issue. I read Randy Yates' paper at > http://home.earthlink.net/~yatescr/fp.pdf. But it is not easy for me to > implement. > > Your helps are appreciated. > > Thanks, > Vu
I'm not sure I understand your problem based on your post. If I interpret it in a simple fashion I'd say that this following snippet should do what you want... float in_data; int fix_data_16; fix_data_16 = ((int) in_data) & 0xFFFF; You can get a little more fancy and add some rounding to this if you want...but I'd say this converts "floating-point to fixed-point with 16 bit-length". If you have an existing algorithm implemented in floating point and you want to convert it to work in fixed point data with 16 bit precision - that's going to take a bunch of work depending on the algorithm that you have to convert. Or...are you looking for C/C++ code that takes as input, code in C/C++ for a floating point algorithm and outputs code for the same algorithm in fixed point?? You won't find any C/C++ code for any of the above 2 problems. Cheers Bhaskar