On Mon, 13 Nov 2000, M. Adam Davis wrote:
> y = ( 1 + x ) / ( 1 - x )
>
> simplifies to
>
> y= 2 / (1-x) - 1
> or
> y= ( -2 / (x-1) ) - 1
I think you meant:
y = 1 + 2x /(1-x)
Right?
If so, then the second term can be simplified by applying this formula:
1 / (A + B) = 1/A * (1 - (B/A) + (B/A)^2 ...)
setting A = 1, and B = -x (recall 0 <x < 1)
y = 1 + 2x * ( 1 + x + x^2 + x^3 + ...)
If x is close to 1, then it'll take a while for this to converge. In fact, if
you look just at:
1/(1-x) = 1 + x + x^2 + ... + x^n + (x^(n+1))/(1-x))
and the error from taking just `n' terms is:
err = 2* (x^(n+2))/(1-x)
e.g. if x=0.1 and n=3
err = 2.2E-05 (y = 1.222)
if x=0.9 n=3
err = 11.8 (y = 19)
yuk!
if x=0.9 n=50
err = 0.0515
But there are some other tricks lurking...
Scott
{Quote hidden}>
> Pick your poison. In both cases you only have a variable on one side of
> the division, rather than both sides. You should be able to optimize a
> simple 24 bit division routine based on that.
>
> -Adam
>
>
.....Andrzey.BaranskiKILLspam@spam@ESA.INT wrote:
> >
> > Andrzey Baranski@ESA
> > 11/13/2000 12:07 PM
> >
> > Here's an equation
> >
> > y = ( 1 + x ) / ( 1 - x )
> >
> > where 0 < x < 1 i.e. Q0.16 format and y should be in Q6.10.
> >
> > Does anybody know a trick to avoid a brute force 24 bits arithmetic ?
> >
> > Looking forward to hearing from you.
> >
> > Best Regards
> >
> > Andrzej Baranski
> >
> > --
> >
http://www.piclist.com hint: PICList Posts must start with ONE topic:
> > "[PIC]:","[SX]:","[AVR]:" =uP ONLY! "[EE]:","[OT]:" =Other "[BUY]:","[AD]:" =Ads
>
> --
>
http://www.piclist.com hint: PICList Posts must start with ONE topic:
> "[PIC]:","[SX]:","[AVR]:" =uP ONLY! "[EE]:","[OT]:" =Other "[BUY]:","[AD]:" =Ads
>
>
>
>
--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
"[PIC]:","[SX]:","[AVR]:" =uP ONLY! "[EE]:","[OT]:" =Other "[BUY]:","[AD]:" =Ads