Julian your answer is cute but really not helpful. I was using Metastock before amibroker and even tough up until now i did not find anything that Metastock could do better than Amibroker, it seems that this is the first thing. Metastock could give ALWAYS the right answer to this simple subraction. Anyone else have a answer? come on people its a subtraction...Metastock could do this, is really no way to get Amibroker give the right answer?
--- In [email protected], "Julian" <juliangoods...@...> wrote: > > Yes, floating point calculations. > > http://docs.sun.com/source/806-3568/ncg_goldberg.html > Bring a pillow. :) > > > You could do: > > ans1 = 1.3941 - 1.3931; > ans2 = ((1.3941*1000)-(1.3931*1000)) / 1000; > _TRACE("Ans1 = " + ans1); > _TRACE("Ans2 = " + ans2); > > though I don't know for sure that there aren't any precision pitfalls with > this technique. > > Jules. > > --- In [email protected], "paul_79c" <paulyes@> wrote: > > > > Does anyone know why Amibroker is unable to give the correct answer to this: > > > > fh = fopen( "C:/Amibroker/"+Name()+"1.txt", "r"); > > if( fh!=0) > > { > > k=StrToNum(fgets(fh)); > > fclose(fh); > > } > > fh1 = fopen( "C:/Amibroker/"+Name()+"spread.txt", "r"); > > if( fh1!=0 ) > > { > > k1=Prec(StrToNum(fgets(fh1)),4); > > fclose(fh1); > > } > > a=Prec(abs((LastValue(C)+k1)-k)+0.0001,4); > > > > I`m using this code on EURUSD trying to perform a simple subtraction but > > Amibroker is unable to give a precise answer, like for example sometimes > > 1.3941-1.3931=0.0009 sometimes =0.0010(correct) sometimes 0.0008 or other > > close value. dont get it its a simple subtraction, obviously has something > > to do with floating point does someone know what to do to get the right > > answer from amibroker? > > >
