diff --git a/src/library/grDevices/src/chull.c b/src/library/grDevices/src/chull.c index 77ffe87b36..aebcfb8ccc 100644 --- a/src/library/grDevices/src/chull.c +++ b/src/library/grDevices/src/chull.c @@ -433,7 +433,6 @@ SEXP chull(SEXP x) for (int i = 0; i < n; i++) in[i] = i+1; int *ih = (int*)R_alloc(4*n, sizeof(int)); x = PROTECT(coerceVector(x, REALSXP)); - if(TYPEOF(x) != REALSXP) error("'x' is not numeric"); in_chull(&n, REAL(x), &n, in, ih+n, ih+2*n, ih, &nh, ih+3*n); SEXP ans = allocVector(INTSXP, nh); int *ians = INTEGER(ans); diff --git a/src/library/graphics/src/base.c b/src/library/graphics/src/base.c index 1e6dfcbe7d..d3348c1c92 100644 --- a/src/library/graphics/src/base.c +++ b/src/library/graphics/src/base.c @@ -351,7 +351,7 @@ static SEXP baseCallback(GEevent task, pGEDevDesc dd, SEXP data) /* Modify the saved settings so this effects display list too */ ddpSaved->scale *= rf; } else - error("event 'GE_ScalePS' requires a single numeric value"); + error("event 'GE_ScalePS' requires a single numeric (double) value"); break; } } diff --git a/src/library/stats/src/port.c b/src/library/stats/src/port.c index 331ede0122..006cbceba9 100644 --- a/src/library/stats/src/port.c +++ b/src/library/stats/src/port.c @@ -1,6 +1,6 @@ /* * R : A Computer Language for Statistical Data Analysis - * Copyright (C) 2005-2024 The R Core Team. + * Copyright (C) 2005-2025 The R Core Team. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -382,16 +382,15 @@ SEXP port_nlminb(SEXP fn, SEXP gr, SEXP hs, SEXP rho, if (isNull(rho)) { error(_("use of NULL environment is defunct")); rho = R_BaseEnv; - } else - if (!isEnvironment(rho)) + } else if (!isEnvironment(rho)) error(_("'rho' must be an environment")); if (!isReal(d) || n < 1) - error(_("'d' must be a nonempty numeric vector")); + error(_("'d' must be a nonempty numeric (double) vector")); if (hs != R_NilValue && gr == R_NilValue) error(_("When Hessian defined must also have gradient defined")); if (R_NilValue == (xpt = findVarInFrame(rho, dot_par_symbol)) || !isReal(xpt) || LENGTH(xpt) != n) - error(_("environment 'rho' must contain a numeric vector '.par' of length %d"), + error(_("environment 'rho' must contain a numeric (double) vector '.par' of length %d"), n); /* We are going to alter .par, so must duplicate it */ defineVar(dot_par_symbol, duplicate(xpt), rho); @@ -405,7 +404,7 @@ SEXP port_nlminb(SEXP fn, SEXP gr, SEXP hs, SEXP rho, b[2*i] = rl[i]; b[2*i + 1] = ru[i]; } - } else error(_("'lower' and 'upper' must be numeric vectors")); + } else error(_("'lower' and 'upper' must be numeric (double) vectors")); } if (gr != R_NilValue) { g = (double *)R_alloc(n, sizeof(double)); @@ -552,7 +551,7 @@ SEXP port_nlsb(SEXP m, SEXP d, SEXP gg, SEXP iv, SEXP v, *rd = (double *)R_alloc(nd, sizeof(double)); if (!isReal(d) || n < 1) - error(_("'d' must be a nonempty numeric vector")); + error(_("'d' must be a nonempty numeric (double) vector")); if(!isNewList(m)) error(_("m must be a list")); /* Initialize parameter vector */ getPars = PROTECT(lang1(getFunc(m, "getPars", "m"))); diff --git a/src/main/raw.c b/src/main/raw.c index 67892caaef..cdb7b97bb5 100644 --- a/src/main/raw.c +++ b/src/main/raw.c @@ -151,8 +151,6 @@ attribute_hidden SEXP do_numToInts(SEXP call, SEXP op, SEXP args, SEXP env) { checkArity(op, args); SEXP x = PROTECT(coerceVector(CAR(args), REALSXP)); - if (!isReal(x)) - error(_("argument 'x' must be a numeric vector")); SEXP ans = PROTECT(allocVector(INTSXP, 2*XLENGTH(x))); R_xlen_t i, j = 0; double *x_ = REAL(x); @@ -169,13 +167,11 @@ attribute_hidden SEXP do_numToInts(SEXP call, SEXP op, SEXP args, SEXP env) UNPROTECT(2); return ans; } -// split "real", i.e. = double = 64-bitd, to bits (<==> do_intToBits( do_numToInts(..) .. )) +// split "real", i.e. = double = 64-bit, to bits (<==> do_intToBits( do_numToInts(..) .. )) attribute_hidden SEXP do_numToBits(SEXP call, SEXP op, SEXP args, SEXP env) { checkArity(op, args); SEXP x = PROTECT(coerceVector(CAR(args), REALSXP)); - if (!isReal(x)) - error(_("argument 'x' must be a numeric vector")); SEXP ans = PROTECT(allocVector(RAWSXP, 64*XLENGTH(x))); R_xlen_t i, j = 0; double *x_ = REAL(x);