ta-lib icon indicating copy to clipboard operation
ta-lib copied to clipboard

Fix overflow in floating point multiplication

Open iglesias opened this issue 1 year ago • 1 comments

iglesias avatar May 01 '24 11:05 iglesias

Thanks. The proposed change is in the right direction, but the fix has to be applied differently though.

So leaving this open for now to keep track.

Two issues with the proposed change: (1) This code is generated. It will be overwritten when the code is regenerated. The change needs to be done in tools/gencode.

(2) The same source code has to remain compatible with Java, C, C++ and C++ managed (and may be Rust soon!). So the fix must either work with all these setup (verified with ta_regtest) OR make your change specific to the language you are fixing with the pre-processor

Example:

/* Generated */ #if defined( _JAVA )
/* Generated */          outReal[outIdx] = inReal0[i]*inReal1[i];  
/* Generated */ #else 
/* Generated */          outReal[outIdx] = ((double)inReal0[i])*inReal1[i];  
/* Generated */ #endif

mario4tier avatar Oct 16 '24 21:10 mario4tier