Sign in

username:

password:



Not a member?

Search audiodsp



Search tips

Subscribe to audiodsp



audiodsp by Keywords

AAC | ADPCM | Convolution | DAFx | FFT | IIR | Mixer | MP3 | MPEG | MPEG-4

Ads

Discussion Groups

Discussion Groups | Audio Signal Processing | 32 bit Fixed point division

Technical discussions related to Audio Signal Processing (digital effects, acoustics, noise reduction, musical signal processing, etc).

  

Post a new Thread

32 bit Fixed point division - bsdap - Sep 28 23:25:00 2005



Hello All,

Can anyone please help me in writing a C code for dividing a 32 bit fixed
point number by another 32 bit number? I already have a code which works
fine for 16 bit (div_s) but it can not be converted to 32 bit. 
So please give me some source code or algorithm for implementing 32 bit
division.
I am intending to make this code as platform independent.

Thanks and Regards,
bd.
	


(You need to be a member of audiodsp -- send a blank email to audiodsp-subscribe@yahoogroups.com )

Re: 32 bit Fixed point division - bhagawan reddy - Sep 29 8:46:00 2005

You can use Newton-Raphson method of successive approximation.
 
The estimate Y (reciprocal of  X) is calculated as :
 
Y = 2*Y - (Y^2 * Xn);
 
where Xn  = norm(X)
 
With a good initial estimate of Y, you should be able to get the solution within 5-6 iterations
for a 32-bit.
 
-Bhagawan

bsdap <bsdap@bsda...> wrote:
Hello All,

Can anyone please help me in writing a C code for dividing a 32 bit fixed
point number by another 32 bit number? I already have a code which works
fine for 16 bit (div_s) but it can not be converted to 32 bit. 
So please give me some source code or algorithm for implementing 32 bit
division.
I am intending to make this code as platform independent.

Thanks and Regards,
bd.
	


(You need to be a member of audiodsp -- send a blank email to audiodsp-subscribe@yahoogroups.com )

Re: 32 bit Fixed point division - bsdap - Sep 30 5:07:00 2005

Thanks for the suggestions,
 
I tried implementing this formula but found that due to repetitive fixed point multiplication
the distortion is high and the accuracy is hampered. Have any one implemented this? Is there
any other method by which this can be done.
 
Thanks again for the reply..Please give more suggestions...
 
Thanks and Regards,
bd.
	bhagawan reddy <bhagawan007@bhag...> wrote:You can use Newton-Raphson method of
successive approximation.
 
The estimate Y (reciprocal of  X) is calculated as :
 
Y = 2*Y - (Y^2 * Xn);
 
where Xn  = norm(X)
 
With a good initial estimate of Y, you should be able to get the solution within 5-6 iterations
for a 32-bit.
 
-Bhagawan

bsdap <bsdap@bsda...> wrote:
Hello All,

Can anyone please help me in writing a C code for dividing a 32 bit fixed
point number by another 32 bit number? I already have a code which works
fine for 16 bit (div_s) but it can not be converted to 32 bit. 
So please give me some source code or algorithm for implementing 32 bit
division.
I am intending to make this code as platform independent.

Thanks and Regards,
bd.
	


(You need to be a member of audiodsp -- send a blank email to audiodsp-subscribe@yahoogroups.com )

Re: 32 bit Fixed point division - bhagawan reddy - Sep 30 9:43:00 2005

I implemented this formula long time back and was able to get acccurate results.
I don't remeber the initial estimate. Please try to increas the iterations and check for
accuracy.
 
The answer you get, should be formulated in this way :
 
Out of  
Y = 2*Y - (Y^2 * Xn);  
you get Yfrac  (fractional part of result)
 
On calculation norm(x) , you get Yexp(exponent part of result)
 
Actual result (Reciprocal of 1/X) = Yfrac *(2^Yexp)

bsdap <bsdap@bsda...> wrote:
Thanks for the suggestions,

I tried implementing this formula but found that due to repetitive fixed point multiplication
the distortion is high and the accuracy is hampered. Have any one implemented this? Is there
any other method by which this can be done.

Thanks again for the reply..Please give more suggestions...

Thanks and Regards,
bd.
	bhagawan reddy wrote:You can use Newton-Raphson method of successive approximation.

The estimate Y (reciprocal of X) is calculated as :

Y = 2*Y - (Y^2 * Xn);

where Xn = norm(X)

With a good initial estimate of Y, you should be able to get the solution within 5-6 iterations
for a 32-bit.

-Bhagawan

bsdap wrote:
Hello All,

Can anyone please help me in writing a C code for dividing a 32 bit fixed
point number by another 32 bit number? I already have a code which works
fine for 16 bit (div_s) but it can not be converted to 32 bit. 
So please give me some source code or algorithm for implementing 32 bit
division.
I am intending to make this code as platform independent.

Thanks and Regards,
bd.
	


(You need to be a member of audiodsp -- send a blank email to audiodsp-subscribe@yahoogroups.com )