| Computers Forum Index » Computer Architecture - Arithmetic » floating point to fixed point conversion |
|
Page 1 of 1 |
|
| Author |
Message |
| riya |
Posted: Wed Feb 22, 2006 3:04 am |
|
|
|
Guest
|
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. |
|
|
| Back to top |
|
|
|
| Dik T. Winter |
Posted: Wed Feb 22, 2006 8:03 am |
|
|
|
Guest
|
In article <1140560293.304615.157010@g44g2000cwa.googlegroups.com> "riya" <riya1012@gmail.com> writes:
Quote: 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
But this data appears to be in fixed point. So I do not see a problem.
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/ |
|
|
| Back to top |
|
|
|
| Jeff Kenton |
Posted: Thu Feb 23, 2006 3:03 am |
|
|
|
Guest
|
What you show is the printed representation of what you are calling
"floating point". What does the internal representation look like (in
hex)? Is it IEEE-754? And what internal representation do you want for
your fixed point numbers?
riya wrote:
Quote: 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.
|
|
|
| Back to top |
|
|
|
| RED |
Posted: Thu Feb 23, 2006 11:13 am |
|
|
|
Guest
|
hey,,
its not in the fixed point.. There are many issues to consider before
fixing up some thing.. for example, the max abolute value... fixed
point conversion is simply multiplying the above decimal number by
powers of 2 (256, 512.. ) and then multiply with the data and divide
(shift right) the result back by the same value. for example, 0.224128
is 57 when multiplied by 256 and rounded off. lets say you have a max
data value of 255. then the results are
255*0.224128 = 57.15264 which rounds to 57
255*57=14535 which right shifted by 8 and rounded off gives 57..
Also one more constraint is the error tolerance.. i can get away using
7 bits instead of 8 bits if 1 bit errors are allowed..
thats for now.. mail if any hics!!
RED |
|
|
| Back to top |
|
|
|
|