Skip to content

Commit

Permalink
Fix error message in ema() and zlema() C code
Browse files Browse the repository at this point in the history
The first argument is supposed to be one string with formats for all
remaining arguments, like sprintf().
  • Loading branch information
joshuaulrich committed Nov 27, 2023
1 parent 9e9bfc9 commit 0b7299f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/moving_averages.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ SEXP ema (SEXP x, SEXP n, SEXP ratio, SEXP wilder) {

if(R_NilValue == n || i_n <= 0) {
if(R_NilValue == ratio || d_ratio <= 0.0) {
error("either 'n' or 'ratio' must be specified and > 0\n",
"'n' is ", n, " 'ratio' is ", ratio);
error("either 'n' or 'ratio' must be specified and > 0\n'n' is %d and 'ratio' is %1.6f", i_n, d_ratio);
} else {
/* If ratio is specified, and n is not, set n to approx 'correct'
* value backed out from ratio */
Expand Down Expand Up @@ -246,8 +245,7 @@ SEXP zlema (SEXP x, SEXP n, SEXP ratio) {

if(R_NilValue == n || i_n <= 0) {
if(R_NilValue == ratio || d_ratio <= 0.0) {
error("either 'n' or 'ratio' must be specified and > 0\n",
"'n' is ", n, " 'ratio' is ", ratio);
error("either 'n' or 'ratio' must be specified and > 0\n'n' is %d and 'ratio' is %1.6f", i_n, d_ratio);
} else {
/* If ratio is specified, and n is not, set n to approx 'correct'
* value backed out from ratio */
Expand Down

0 comments on commit 0b7299f

Please sign in to comment.