Skip to content

Commit 0b7299f

Browse files
committed
Fix error message in ema() and zlema() C code
The first argument is supposed to be one string with formats for all remaining arguments, like sprintf().
1 parent 9e9bfc9 commit 0b7299f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/moving_averages.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ SEXP ema (SEXP x, SEXP n, SEXP ratio, SEXP wilder) {
3939

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

247246
if(R_NilValue == n || i_n <= 0) {
248247
if(R_NilValue == ratio || d_ratio <= 0.0) {
249-
error("either 'n' or 'ratio' must be specified and > 0\n",
250-
"'n' is ", n, " 'ratio' is ", ratio);
248+
error("either 'n' or 'ratio' must be specified and > 0\n'n' is %d and 'ratio' is %1.6f", i_n, d_ratio);
251249
} else {
252250
/* If ratio is specified, and n is not, set n to approx 'correct'
253251
* value backed out from ratio */

0 commit comments

Comments
 (0)