Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move checks to zlema() C code, fix 'n' calculation
This uses many of the same checks, in the same order, as the ema() C function. That makes it easier and safer to call zlema() from other C functions. This also fixes the issue flagged by clang-UBSAN: We approximated 'n' using 'ratio', but it was possible that ratio = 0. There was a check for ratio > 0 later in the function, but that didn't prevent the possibility of division by 0. Thanks to Prof Ripley for the report. See #100, see #69.
- Loading branch information