Skip to content

Commit c6e470e

Browse files
author
ripley
committed
r87945 also required reverting r87940
git-svn-id: https://svn.r-project.org/R/trunk@87946 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 82429f7 commit c6e470e

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

src/main/envir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ attribute_hidden void unbindVar(SEXP symbol, SEXP rho)
875875
Callers set *canCache = TRUE or NULL
876876
*/
877877

878-
static SEXP findVarLocInFrame(SEXP rho, SEXP symbol, bool *canCache)
878+
static SEXP findVarLocInFrame(SEXP rho, SEXP symbol, Rboolean *canCache)
879879
{
880880
int hashcode;
881881
SEXP frame, c;
@@ -1183,7 +1183,7 @@ void readS3VarsFromFrame(SEXP rho,
11831183
static SEXP findGlobalVarLoc(SEXP symbol)
11841184
{
11851185
SEXP vl, rho;
1186-
bool canCache = TRUE;
1186+
Rboolean canCache = TRUE;
11871187
vl = R_GetGlobalCacheLoc(symbol);
11881188
if (vl != R_UnboundValue)
11891189
return vl;

src/nmath/dpois.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ double dpois_raw(double x, double lambda, int give_log)
5959
double yh, yl;
6060
ebd0 (x, lambda, &yh, &yl);
6161
yl += stirlerr(x);
62-
Rboolean Lrg_x = (x >= x_LRG); //really large x <==> 2*pi*x overflows
62+
bool Lrg_x = (x >= x_LRG); //really large x <==> 2*pi*x overflows
6363
double r = Lrg_x
6464
? M_SQRT_2PI * sqrt(x) // sqrt(.): avoid overflow for very large x
6565
: M_2PI * x;

src/nmath/dt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ double dt(double x, double n, int give_log)
5151
x2n = x*x/n, // in [0, Inf]
5252
ax = 0., // <- -Wpedantic
5353
l_x2n; // := log(sqrt(1 + x2n)) = log(1 + x2n)/2
54-
Rboolean lrg_x2n = (x2n > 1./DBL_EPSILON);
54+
bool lrg_x2n = (x2n > 1./DBL_EPSILON);
5555
if (lrg_x2n) { // large x^2/n :
5656
ax = fabs(x);
5757
l_x2n = log(ax) - log(n)/2.; // = log(x2n)/2 = 1/2 * log(x^2 / n)

src/nmath/qDiscrete_search.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060

6161
static double DO_SEARCH_FUN(_dist_PARS_DECL_)
6262
{
63-
Rboolean left = (lower_tail ? (*z >= p) : (*z < p));
63+
bool left = (lower_tail ? (*z >= p) : (*z < p));
6464
R_DBG_printf(" do_search(y=%g, z=%15.10g %s p = %15.10g) --> search to %s",
6565
y, *z, (lower_tail ? ">=" : "<"), p, (left ? "left" : "right"));
6666
if(incr > 1)

src/nmath/qt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ double qt(double p, double ndf, int lower_tail, int log_p)
101101

102102
P = R_D_qIv(p); /* if exp(p) underflows, we fix below */
103103

104-
Rboolean neg = (!lower_tail || P < 0.5) && (lower_tail || P > 0.5),
104+
bool neg = (!lower_tail || P < 0.5) && (lower_tail || P > 0.5),
105105
is_neg_lower = (lower_tail == neg); /* both TRUE or FALSE == !xor */
106106
if(neg)
107107
P = 2 * (log_p ? (lower_tail ? P : -expm1(p)) : R_D_Lval(p));
@@ -143,7 +143,7 @@ double qt(double p, double ndf, int lower_tail, int log_p)
143143
b = 48 / (a * a),
144144
c = ((20700 * a / b - 98) * a - 16) * a + 96.36,
145145
d = ((94.5 / (b + c) - 3) / b + 1) * sqrt(a * M_PI_2) * ndf;
146-
Rboolean
146+
bool
147147
P_ok1 = P > DBL_MIN || !log_p,
148148
P_ok = P_ok1; // when true (after check below), use "normal scale": log_p=FALSE
149149
if(P_ok1) {

src/nmath/rhyper.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ double rhyper(double nn1in, double nn2in, double kkin)
8686

8787
int nn1, nn2, kk;
8888
int ix; // return value (coerced to double at the very end)
89-
Rboolean setup1, setup2;
89+
bool setup1, setup2;
9090

9191
/* These should become 'thread_local globals' : */
9292
static int ks = -1, n1s = -1, n2s = -1;
@@ -120,20 +120,20 @@ double rhyper(double nn1in, double nn2in, double kkin)
120120
}
121121
// Slow, but safe: return F^{-1}(U) where F(.) = phyper(.) and U ~ U[0,1]
122122
return qhyper(unif_rand(), nn1in, nn2in, kkin,
123-
/*lower_tail =*/ FALSE, /*log_p = */ FALSE);
124-
// lower_tail=FALSE: a thinko, is still "correct" as equiv. to U <--> 1-U
123+
/*lower_tail =*/ false, /*log_p = */ false);
124+
// lower_tail=false: a thinko, is still "correct" as equiv. to U <--> 1-U
125125
}
126126
nn1 = (int)nn1in;
127127
nn2 = (int)nn2in;
128128
kk = (int)kkin;
129129

130130
/* if new parameter values, initialize */
131131
if (nn1 != n1s || nn2 != n2s) { // n1 | n2 is changed: setup all
132-
setup1 = TRUE; setup2 = TRUE;
132+
setup1 = true; setup2 = true;
133133
} else if (kk != ks) { // n1 & n2 are unchanged: setup 'k' only
134-
setup1 = FALSE; setup2 = TRUE;
134+
setup1 = false; setup2 = true;
135135
} else { // all three unchanged ==> no setup
136-
setup1 = FALSE; setup2 = FALSE;
136+
setup1 = false; setup2 = false;
137137
}
138138
if (setup1) { // n1 & n2
139139
n1s = nn1; n2s = nn2; // save
@@ -269,7 +269,7 @@ double rhyper(double nn1in, double nn2in, double kkin)
269269
}
270270

271271
/* acceptance/rejection test */
272-
Rboolean reject = TRUE;
272+
bool reject = true;
273273

274274
if (m < 100 || ix <= 50) {
275275
/* explicit evaluation */
@@ -288,7 +288,7 @@ double rhyper(double nn1in, double nn2in, double kkin)
288288
f = f * i * (n2 - k + i) / (n1 - i + 1) / (k - i + 1);
289289
}
290290
if (v <= f) {
291-
reject = FALSE;
291+
reject = false;
292292
}
293293
} else {
294294

@@ -331,7 +331,7 @@ double rhyper(double nn1in, double nn2in, double kkin)
331331
/* test against upper bound */
332332
alv = log(v);
333333
if (alv > ub) {
334-
reject = TRUE;
334+
reject = true;
335335
} else {
336336
/* test against lower bound */
337337
dr = xm * (r * r * r * r);
@@ -348,16 +348,16 @@ double rhyper(double nn1in, double nn2in, double kkin)
348348
de /= (1.0 + e);
349349
if (alv < ub - 0.25 * (dr + ds + dt + de)
350350
+ (y + m) * (gl - gu) - deltal) {
351-
reject = FALSE;
351+
reject = false;
352352
}
353353
else {
354354
/* * Stirling's formula to machine accuracy
355355
*/
356356
if (alv <= (a - afc(ix) - afc(n1 - ix)
357357
- afc(k - ix) - afc(n2 - k + ix))) {
358-
reject = FALSE;
358+
reject = false;
359359
} else {
360-
reject = TRUE;
360+
reject = true;
361361
}
362362
}
363363
}

0 commit comments

Comments
 (0)