Hello, There is* no problem* with adding 1000 to positionscore.
You are adding the same value to *all* positionscore numbers and by doing so you will NOT change the ordering (ranking) even if 8th significant digit is subject to standard IEEE 32-bit rounding, because larger number will still be larger after adding constant, no matter if result is rounded in 8th significant place or not. So it is irrelevant. Also, it is important to understand that AmiBroker AFL arrays use standard 32-bit floating point, recommended reading: http://en.wikipedia.org/wiki/IEEE754 The same is used by majority of T/A applications since there is really no point in wasting memory on more. Using 32-bit floating point has two main advantages: a) consumes HALF of memory required for doubles (this *is* important, more important that you think, because if you have for example 500000 bars, in floats it is 2MB and it fits into CPU cache, while in doubles it would be 4MB and may not fit into CPU cache). b) 32-bit floating point numbers can be computed much faster. It simply takes less processor cycles to compute 32-bit float than 64-bit float. 64-bit version of AmiBroker is going even further and is using SSE2 instructions. This means that vectors of 4 single-precision numbers are processed in parallel using single SSE2 instruction on SINGLE processor. This gives more speed on single core than achievable using multiple cores. Note also AmiBroker *does use double precision (64bit)* where it is necessary (for certain internal calculations) Best regards, Tomasz Janeczko amibroker.com On 2010-07-20 01:37, Paul D wrote:
Oh whoops. Sorry - apparently I didn't read your question carefully enough. Not sure how to solve the precision problem. Paul ---------------------------------------------------------------------------------------------------------------------------------------------------------------- *From:* Herman <[email protected]> *To:* bistrader <[email protected]> *Sent:* Mon, July 19, 2010 3:19:01 PM *Subject:* Re: [amibroker] Why does adding 10000 to PositionScore cause problems? You are exceeding the 7-digit precision (32 bits?) of AmiBroker. herman *> I have an afl with PositionScore at 77.904854 for one > ticker. PositionScore also has negative values for > certain tickers for certain dates. So, I add 10000 to > PositionScore as I want all PositionScore values to be > positive. I do so as followings and notice that 77.904854 > changes to 10077.90527. Happens to many tickers. Not > what I expected. I expected values to increase by exactly 10000. > PositionScore = rank; // 77.904854 is one value observed > PositionScaore = PositionScore + 10000; // expect to get > 10077.904854 but get 10077.90527 > I know I am missing something with precision. I looked > in help but could not find anything to help. Does anyone > know what is going on and where in documentation? > Thanks. > ------------ --------- --------- ------ > **** IMPORTANT PLEASE READ **** > This group is for the discussion between users only. > This is *NOT* technical support channel. > TO GET TECHNICAL SUPPORT send an e-mail directly to > SUPPORT {at} amibroker.com <http://amibroker.com> > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at > http://www.amibroke r.com/feedback/ <http://www.amibroker.com/feedback/> > (submissions sent via other channels won't be considered) > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > http://www.amibroke r.com/devlog/ <http://www.amibroker.com/devlog/> > Yahoo! Groups Links * * * * *
