Author Topic: 64 Bit Bug?  (Read 2508 times)

stdpro

  • Newbie
  • *
  • Posts: 3
    • View Profile
64 Bit Bug?
« on: December 18, 2013, 04:04:57 pm »
// The following AFL code snippet is driving me crazy!

// I'm running the 64 bit Pro version of Amibroker 5.63 on a 64 bit Intel (2 core) Toshiba Laptop.

P1 = Ultimate();  // Problem is not unique to Ultimate() OR the Stock
TT=100*(P1-LLV(P1,3))/(HHV(P1,3)-LLV(P1,3));

SMTH=MA(TT,11); //  This results in a constant value of -1.#j for all quotes.

// SMTH=MA(0+TT,11);  // This appears to produce correct results.

Plot(SMTH,"SMTH",colorRed,styleLine);

// I've seen reports of earlier problems with the 64 bit Version.
// Are there still unresolved issues?

//  Thanks for any insights.

stdpro

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: 64 Bit Bug?
« Reply #1 on: December 18, 2013, 04:29:18 pm »
Correction:  I'm running Version 5.60.3, Build Date December 4, 2012

Aminerd

  • Full Member
  • ***
  • Posts: 108
    • View Profile
Re: 64 Bit Bug?
« Reply #2 on: December 19, 2013, 06:09:39 pm »
It's not a bug. As posted by the developer of AmiBroker on the Yahoo list you are dividing by zero and result is infinity.

here is his fix of your code
Quote
"To avoid that you need to use
SMTH=MA(Nz(TT),11);

or just add small value:
TT=100*(P1-LLV(P1,3))/(HHV(P1,3)-LLV(P1,3) + 0.00001); "

stdpro

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: 64 Bit Bug?
« Reply #3 on: December 31, 2013, 05:09:50 pm »
I saw his fix too.  Obviously not every bar has a division by zero, as evidenced by the result of the fix.  What I was hoping for was for someone to explain why MY fix worked as well.  Uncomment the line with MY fix and comment out the offending line.  Adding zero to +- Infinity shouldn't have much effect on it, but in this case, it apparently does.  :-)