ta-lib
ta-lib copied to clipboard
Fix overflow in floating point multiplication
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