You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/assign.c
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -967,14 +967,14 @@ const char *memrecycle(const SEXP target, const SEXP where, const int start, con
967
967
caseINTSXP: CHECK_RANGE(int, INTEGER, val<0||val>255, val, _("%d (type '%s') at RHS position %d taken as 0 when assigning to type '%s' %s"))
968
968
caseREALSXP: if (sourceIsI64)
969
969
CHECK_RANGE(int64_t, REAL, val<0||val>255, val, _("%"PRId64" (type '%s') at RHS position %d taken as 0 when assigning to type '%s' %s"))
970
-
elseCHECK_RANGE(double, REAL, !R_FINITE(val) ||val<0.0||val>256.0|| (int)val!=val, val, _("%f (type '%s') at RHS position %d either truncated (precision lost) or taken as 0 when assigning to type '%s' %s"))
970
+
elseCHECK_RANGE(double, REAL, !isfinite(val) ||val<0.0||val>256.0|| (int)val!=val, val, _("%f (type '%s') at RHS position %d either truncated (precision lost) or taken as 0 when assigning to type '%s' %s"))
971
971
} break;
972
972
caseINTSXP:
973
973
switch (TYPEOF(source)) {
974
974
caseREALSXP: if (sourceIsI64)
975
975
CHECK_RANGE(int64_t, REAL, val!=NA_INTEGER64&& (val<=NA_INTEGER||val>INT_MAX), val, _("%"PRId64" (type '%s') at RHS position %d out-of-range (NA) when assigning to type '%s' %s"))
976
976
elseCHECK_RANGE(double, REAL, !ISNAN(val) && (!within_int32_repres(val) || (int)val!=val), val, _("%f (type '%s') at RHS position %d out-of-range(NA) or truncated (precision lost) when assigning to type '%s' %s"))
(ISNAN(val.r) || (within_int32_repres(val.r) && (int)val.r==val.r))), val.r, _("%f (type '%s') at RHS position %d either imaginary part discarded or real part truncated (precision lost) when assigning to type '%s' %s"))
979
979
} break;
980
980
caseREALSXP:
@@ -983,9 +983,9 @@ const char *memrecycle(const SEXP target, const SEXP where, const int start, con
983
983
CHECK_RANGE(double, REAL, !ISNAN(val) && (!within_int64_repres(val) || (int64_t)val!=val), val, _("%f (type '%s') at RHS position %d out-of-range(NA) or truncated (precision lost) when assigning to type '%s' %s"))
(ISNAN(val.r) || (R_FINITE(val.r) && (int64_t)val.r==val.r))), val.r, _("%f (type '%s') at RHS position %d either imaginary part discarded or real part truncated (precision lost) when assigning to type '%s' %s"))
988
-
elseCHECK_RANGE(Rcomplex, COMPLEX, !(ISNAN(val.i) || (R_FINITE(val.i) &&val.i==0.0)), val.r, _("%f (type '%s') at RHS position %d imaginary part discarded when assigning to type '%s' %s"))
(ISNAN(val.r) || (isfinite(val.r) && (int64_t)val.r==val.r))), val.r, _("%f (type '%s') at RHS position %d either imaginary part discarded or real part truncated (precision lost) when assigning to type '%s' %s"))
988
+
elseCHECK_RANGE(Rcomplex, COMPLEX, !(ISNAN(val.i) || (isfinite(val.i) &&val.i==0.0)), val.r, _("%f (type '%s') at RHS position %d imaginary part discarded when assigning to type '%s' %s"))
if (u.d==0) u.d=0; // changes -0.0 to 0.0, issue #743
431
431
u.u64 ^= (u.u64&0x8000000000000000) ? 0xffffffffffffffff : 0x8000000000000000; // always flip sign bit and if negative (sign bit was set) flip other bits too
432
432
u.u64+= (u.u64&dmask) << 1/*is this shift really correct. No need to shift*/ ; // when dround==1|2, if 8th|16th bit is set, round up before chopping last 1|2 bytes
ans->dbl_v[i] = (double) (w / k); // first full sliding window, non-fill rollfun answer
68
-
if (R_FINITE((double) w)) { // proceed only if no NAs detected in first k obs, otherwise early stopping
68
+
if (isfinite((double) w)) { // proceed only if no NAs detected in first k obs, otherwise early stopping
69
69
for (uint64_ti=k; i<nx; i++) { // loop over obs, complete window, all remaining after partial window
70
70
w-=x[i-k]; // remove leaving row from sliding window
71
71
w+=x[i]; // add current row to sliding window
72
72
ans->dbl_v[i] = (double) (w / k); // rollfun to answer vector
73
73
}
74
-
if (!R_FINITE((double) w)) { // mark to re-run with NA care
74
+
if (!isfinite((double) w)) { // mark to re-run with NA care
75
75
if (hasna==-1) { // raise warning
76
76
ans->status=2;
77
77
snprintf(end(ans->message[2]), 500, _("%s: hasNA=FALSE used but NA (or other non-finite) value(s) are present in input, use default hasNA=NA to avoid this warning"), __func__);
for (intj=-k+1; j<=0; j++) { // sub-loop on window width
159
159
w+=x[i+j]; // sum of window for particular observation
160
160
}
161
-
if (R_FINITE((double) w)) { // no need to calc roundoff correction if NAs detected as will re-call all below in truehasna==1
161
+
if (isfinite((double) w)) { // no need to calc roundoff correction if NAs detected as will re-call all below in truehasna==1
162
162
long doubleres=w / k; // keep results as long double for intermediate processing
163
163
long doubleerr=0.0; // roundoff corrector
164
164
for (intj=-k+1; j<=0; j++) { // nested loop on window width
@@ -268,13 +268,13 @@ void frollsumFast(double *x, uint64_t nx, ans_t *ans, int k, double fill, bool n
268
268
}
269
269
w+=x[i];
270
270
ans->dbl_v[i] = (double) w;
271
-
if (R_FINITE((double) w)) {
271
+
if (isfinite((double) w)) {
272
272
for (uint64_ti=k; i<nx; i++) {
273
273
w-=x[i-k];
274
274
w+=x[i];
275
275
ans->dbl_v[i] = (double) w;
276
276
}
277
-
if (!R_FINITE((double) w)) {
277
+
if (!isfinite((double) w)) {
278
278
if (hasna==-1) {
279
279
ans->status=2;
280
280
snprintf(end(ans->message[2]), 500, _("%s: hasNA=FALSE used but NA (or other non-finite) value(s) are present in input, use default hasNA=NA to avoid this warning"), __func__);
@@ -299,14 +299,14 @@ void frollsumFast(double *x, uint64_t nx, ans_t *ans, int k, double fill, bool n
299
299
intnc=0;
300
300
inti;
301
301
for (i=0; i<k-1; i++) { // #loop_counter_not_local_scope_ok
302
-
if (R_FINITE(x[i])) {
302
+
if (isfinite(x[i])) {
303
303
w+=x[i];
304
304
} else {
305
305
nc++;
306
306
}
307
307
ans->dbl_v[i] =fill;
308
308
}
309
-
if (R_FINITE(x[i])) {
309
+
if (isfinite(x[i])) {
310
310
w+=x[i];
311
311
} else {
312
312
nc++;
@@ -319,12 +319,12 @@ void frollsumFast(double *x, uint64_t nx, ans_t *ans, int k, double fill, bool n
0 commit comments