As far as For .vs. Sum is concerned ... The AFL below will demonstrate that the first 6 digits are the same ... and the 7th is close ...
BI = BarIndex(); LVBI = LastValue(BI); XBI = (BI * 0.00001) ^ 0.987654321; SumXBI = Sum(XBI, 100); forXBI = Cum(0); for (i = LVBI - 99; i <= LVBI; i++) { forXBI[LVBI] = forXBI[LVBI] + XBI[i]; } Filter = BI == LVBI; AddColumn(XBI, "XBI", 1.9); AddColumn(SumXBI, "SumXBI", 1.9); AddColumn(forXBI, "ForXBI", 1.9); --- In amibroker@yahoogroups.com, "Fred" <[EMAIL PROTECTED]> wrote: > > I agree completely with #1 ... > > --- In amibroker@yahoogroups.com, "Tom Tom" <michel_b_g@> wrote: > > > > Thanks Paul and Ed. > > > > It is a shame because i manage to code AR Burg method all in AFL > native. > > Two points are not so good in my coding : > > > > 1- Loop for need to flip an array. There is no such function in > native AFL, > > but it is very usefull sometimes for many algorythm. > > Exemple : [1 5 4 8] -> [8 4 5 1] > > Is there a way do do it without loop ? (if not possible thomas you > cannot > > add a function flip_array ? very usefull for all lattice filter or > backwards > > recursion) > > > > Code : > > for (j = 1; j < i; j++) a_old_flip[j] = a_old[i-j]; > > > > 2- Precision digit make many sensitive algorythm not done by AFL. > Bu i think > > it is done to have full speed from AB, so great. > > But I have not the same result for SUM and FOR(i=0,...) > > > > Code : > > > > AFL SUM function : > > Num = 0; Den = 0; > > Num = Sum(W*f*b_shifted, LongBar - i); > > Den = Sum(W*(f^2 + b_shifted^2), LongBar - i); > > k[i] = 2*Num[LongBar - 1]/Den[LongBar - 1]; > > > > FOR : > > Num = 0; Den = 0; > > for (j = i; j < LongBar; j++) { > > Num = Num + 100000*W[j]*( f[j]*b[j-1] ); > > Den = Den + 100000*W[j]*( f[j]^2 + b[j-1]^2 ); > > } > > k[i] = 2*Num/Den; > > > > I have not the same result for the number k[i] !? > > For small number on small period formula give back same result... > but for > > long periods... i end up with slightly different number (and for > AR coef, it > > means big diff... arhhh). > > which is better SUM or FOR (I had to test by coding it in JSscript > or > > VBscript and compare maybe) ? > > > > Thanks again. > > > > Cheers, > > Mich. > > > > > > > > > > ----- Original Message ----- > > From: Ed Hoopes > > To: amibroker@yahoogroups.com > > Sent: Thursday, November 16, 2006 5:17 PM > > Subject: [amibroker] Re: Digit precision on AB ? > > > > > > Also, the default precision in javascript is double. > > > > --- In amibroker@yahoogroups.com, "Paul Ho" .> wrote: > > > > > >you can only doing single precision floating points within AFL > all > > >functions that I called returned single precision, 1. I thought > it was 8 > > >significant digits > > >http://en.wikipedia.org/wiki/IEEE_754; > > >2. yes or dll > > >3. for and sum should give the same answer. > > >cheers > > >Paul. > > > > > >_____ > > > > > >From: amibroker@yahoogroups.com [mailto:[EMAIL PROTECTED] > > On Behalf > > >Of Tom Tom > > >Sent: Thursday, 16 November 2006 7:01 PM > > >To: amibroker@yahoogroups.com > > >Subject: [amibroker] Digit precision on AB ? > > > > > > > > > > > >Hello, > > > > > >Does someone can help me about digit precision on AB please. > > > > > >1- I think it is 7 signifiant digit +exposant +signe. Am i right ? > > > > > >2- For more precision we need to code in VBscript and enable > double > > float ? > > > > > >3- But if i prefer stay on Amibroker AFL. For a sum loop for > exemple, i > > >didn't have same result with looping with FOR(i=...) and with > > SUM(array, > > >periods). SUM is better ? Native AFL included function work inside > > with only > > > > > >7 digit precision too, or they work in more precision and send > back > > function > > > > > >result in 7 digit format. If it is the case, SUM should give > better > > calcul > > >accuracy than FOR(i=...) ? > > > > > >Thanks, > > >Mich. > > > > > >__________________________________________________________ > > >Windows Live Messenger sur i-modeT : dialoguez avec vos amis > depuis > > votre > > >mobile comme sur PC ! http://mobile. > > ><http://mobile.live.fr/messenger/bouygues/> > live.fr/messenger/bouygues/ > > > > > > > > > > > > > _________________________________________________________________ > > Retrouvez tout en un clin d'oeil avec Live Search ! > > http://www.live.com/?mkt=fr-fr > > >