From 0b7299f9d3f6cad057e7d87f53c019d25a6c20a9 Mon Sep 17 00:00:00 2001 From: Joshua Ulrich Date: Mon, 27 Nov 2023 17:49:29 -0600 Subject: [PATCH] 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(). --- src/moving_averages.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/moving_averages.c b/src/moving_averages.c index 554bd60..4e08ece 100644 --- a/src/moving_averages.c +++ b/src/moving_averages.c @@ -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 */ @@ -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 */