11/*
22 * R : A Computer Language for Statistical Data Analysis
3- * Copyright (C) 2000-2022 The R Core Team
3+ * Copyright (C) 2000-2025 The R Core Team
44 * Copyright (C) 2005 The R Foundation
55 * Copyright (C) 1995-1997 Robert Gentleman and Ross Ihaka
66 *
@@ -585,18 +585,18 @@ static double complex z_atanh(double complex z)
585585 return - I * z_atan (z * I );
586586}
587587
588- static Rboolean cmath1 (double complex (* f )(double complex ),
588+ static bool cmath1 (double complex (* f )(double complex ),
589589 const Rcomplex * x , Rcomplex * y , R_xlen_t n )
590590{
591591 R_xlen_t i ;
592- Rboolean naflag = FALSE ;
592+ bool naflag = false ;
593593 for (i = 0 ; i < n ; i ++ ) {
594594 if (ISNA (x [i ].r ) || ISNA (x [i ].i )) {
595595 y [i ].r = NA_REAL ; y [i ].i = NA_REAL ;
596596 } else {
597597 SET_C99_COMPLEX (y , i , f (toC99 (x + i )));
598598 if ( (ISNAN (y [i ].r ) || ISNAN (y [i ].i )) &&
599- !(ISNAN (x [i ].r ) || ISNAN (x [i ].i )) ) naflag = TRUE ;
599+ !(ISNAN (x [i ].r ) || ISNAN (x [i ].i )) ) naflag = true ;
600600 }
601601 }
602602 return naflag ;
@@ -606,7 +606,7 @@ attribute_hidden SEXP complex_math1(SEXP call, SEXP op, SEXP args, SEXP env)
606606{
607607 SEXP x , y ;
608608 R_xlen_t n ;
609- Rboolean naflag = FALSE ;
609+ bool naflag = false ;
610610
611611 PROTECT (x = CAR (args ));
612612 n = XLENGTH (x );
@@ -696,7 +696,7 @@ attribute_hidden SEXP complex_math2(SEXP call, SEXP op, SEXP args, SEXP env)
696696 Rcomplex ai , bi , * y ;
697697 const Rcomplex * a , * b ;
698698 SEXP sa , sb , sy ;
699- Rboolean naflag = FALSE ;
699+ bool naflag = false ;
700700 cm2_fun f ;
701701
702702 switch (PRIMVAL (op )) {
@@ -734,7 +734,7 @@ attribute_hidden SEXP complex_math2(SEXP call, SEXP op, SEXP args, SEXP env)
734734 f (& y [i ], & ai , & bi );
735735 if ( (ISNAN (y [i ].r ) || ISNAN (y [i ].i )) &&
736736 !(ISNAN (ai .r ) || ISNAN (ai .i ) || ISNAN (bi .r ) || ISNAN (bi .i )) )
737- naflag = TRUE ;
737+ naflag = true ;
738738 }
739739 });
740740 if (naflag )
@@ -787,12 +787,12 @@ attribute_hidden SEXP do_complex(SEXP call, SEXP op, SEXP args, SEXP rho)
787787}
788788
789789static void R_cpolyroot (double * opr , double * opi , int * degree ,
790- double * zeror , double * zeroi , Rboolean * fail );
790+ double * zeror , double * zeroi , bool * fail );
791791
792792attribute_hidden SEXP do_polyroot (SEXP call , SEXP op , SEXP args , SEXP rho )
793793{
794794 SEXP z , zr , zi , r , rr , ri ;
795- Rboolean fail ;
795+ bool fail ;
796796 int degree , i , n ;
797797
798798 checkArity (op , args );
@@ -904,10 +904,10 @@ attribute_hidden SEXP do_polyroot(SEXP call, SEXP op, SEXP args, SEXP rho)
904904
905905#include <Rmath.h> /* for R_pow_di */
906906
907- static void calct (Rboolean * );
908- static Rboolean fxshft (int , double * , double * );
909- static Rboolean vrshft (int , double * , double * );
910- static void nexth (Rboolean );
907+ static void calct (bool * );
908+ static bool fxshft (int , double * , double * );
909+ static bool vrshft (int , double * , double * );
910+ static void nexth (bool );
911911static void noshft (int );
912912
913913static void polyev (int , double , double ,
@@ -931,30 +931,30 @@ static const double mre = 2. * M_SQRT2 * /* eta, i.e. */DBL_EPSILON;
931931static const double infin = DBL_MAX ;
932932
933933static void R_cpolyroot (double * opr , double * opi , int * degree ,
934- double * zeror , double * zeroi , Rboolean * fail )
934+ double * zeror , double * zeroi , bool * fail )
935935{
936936 static const double smalno = DBL_MIN ;
937937 static const double base = (double )FLT_RADIX ;
938938 static int d_n , i , i1 , i2 ;
939939 static double zi , zr , xx , yy ;
940940 static double bnd , xxx ;
941- Rboolean conv ;
941+ bool conv ;
942942 int d1 ;
943943 double * tmp ;
944944 static const double cosr = /* cos 94 */ -0.06975647374412529990 ;
945945 static const double sinr = /* sin 94 */ 0.99756405025982424767 ;
946946 xx = M_SQRT1_2 ;/* 1/sqrt(2) = 0.707.... */
947947
948948 yy = - xx ;
949- * fail = FALSE ;
949+ * fail = false ;
950950
951951 nn = * degree ;
952952 d1 = nn - 1 ;
953953
954954 /* algorithm fails if the leading coefficient is zero. */
955955
956956 if (opr [0 ] == 0. && opi [0 ] == 0. ) {
957- * fail = TRUE ;
957+ * fail = true ;
958958 return ;
959959 }
960960
@@ -1037,7 +1037,7 @@ static void R_cpolyroot(double *opr, double *opi, int *degree,
10371037 /* the zerofinder has failed on two major passes */
10381038 /* return empty handed */
10391039
1040- * fail = TRUE ;
1040+ * fail = true ;
10411041 vmaxset (vmax );
10421042 return ;
10431043
@@ -1113,7 +1113,7 @@ static void noshft(int l1)
11131113 * initiates a variable-shift iteration and returns with the
11141114 * approximate zero if successful.
11151115 */
1116- static Rboolean fxshft (int l2 , double * zr , double * zi )
1116+ static bool fxshft (int l2 , double * zr , double * zi )
11171117{
11181118/* l2 - limit of fixed shift steps
11191119 * zr,zi - approximate zero if convergence (result TRUE)
@@ -1123,7 +1123,7 @@ static Rboolean fxshft(int l2, double *zr, double *zi)
11231123 * Uses global (sr,si), nn, pr[], pi[], .. (all args of polyev() !)
11241124*/
11251125
1126- Rboolean pasd , h_s_0 , test ;
1126+ bool pasd , h_s_0 , test ;
11271127 static double svsi , svsr ;
11281128 static int i , j , n ;
11291129 static double oti , otr ;
@@ -1134,8 +1134,8 @@ static Rboolean fxshft(int l2, double *zr, double *zi)
11341134
11351135 polyev (nn , sr , si , pr , pi , qpr , qpi , & pvr , & pvi );
11361136
1137- test = TRUE ;
1138- pasd = FALSE ;
1137+ test = true ;
1138+ pasd = false ;
11391139
11401140 /* calculate first t = -p(s)/h(s). */
11411141
@@ -1160,10 +1160,10 @@ static Rboolean fxshft(int l2, double *zr, double *zi)
11601160
11611161 if (!h_s_0 && test && j != l2 ) {
11621162 if (hypot (tr - otr , ti - oti ) >= hypot (* zr , * zi ) * 0.5 ) {
1163- pasd = FALSE ;
1163+ pasd = false ;
11641164 }
11651165 else if (! pasd ) {
1166- pasd = TRUE ;
1166+ pasd = true ;
11671167 }
11681168 else {
11691169
@@ -1179,14 +1179,14 @@ static Rboolean fxshft(int l2, double *zr, double *zi)
11791179 svsr = sr ;
11801180 svsi = si ;
11811181 if (vrshft (10 , zr , zi )) {
1182- return TRUE ;
1182+ return true ;
11831183 }
11841184
11851185 /* the iteration failed to converge. */
11861186 /* turn off testing and restore */
11871187 /* h, s, pv and t. */
11881188
1189- test = FALSE ;
1189+ test = false ;
11901190 for (i = 1 ; i <=n ; i ++ ) {
11911191 hr [i - 1 ] = shr [i - 1 ];
11921192 hi [i - 1 ] = shi [i - 1 ];
@@ -1208,7 +1208,7 @@ static Rboolean fxshft(int l2, double *zr, double *zi)
12081208
12091209/* carries out the third stage iteration.
12101210 */
1211- static Rboolean vrshft (int l3 , double * zr , double * zi )
1211+ static bool vrshft (int l3 , double * zr , double * zi )
12121212{
12131213/* l3 - limit of steps in stage 3.
12141214 * zr,zi - on entry contains the initial iterate;
@@ -1218,12 +1218,12 @@ static Rboolean vrshft(int l3, double *zr, double *zi)
12181218 *
12191219 * Assign and uses GLOBAL sr, si
12201220*/
1221- Rboolean h_s_0 , b ;
1221+ bool h_s_0 , b ;
12221222 static int i , j ;
12231223 static double r1 , r2 , mp , ms , tp , relstp ;
12241224 static double omp ;
12251225
1226- b = FALSE ;
1226+ b = false ;
12271227 sr = * zr ;
12281228 si = * zi ;
12291229
@@ -1254,7 +1254,7 @@ static Rboolean vrshft(int l3, double *zr, double *zi)
12541254 /* one zero to dominate. */
12551255
12561256 tp = relstp ;
1257- b = TRUE ;
1257+ b = true ;
12581258 if (relstp < eta )
12591259 tp = eta ;
12601260 r1 = sqrt (tp );
@@ -1275,7 +1275,7 @@ static Rboolean vrshft(int l3, double *zr, double *zi)
12751275 /* increases significantly. */
12761276
12771277 if (mp * .1 > omp )
1278- return FALSE ;
1278+ return false ;
12791279 }
12801280 }
12811281 omp = mp ;
@@ -1292,15 +1292,15 @@ static Rboolean vrshft(int l3, double *zr, double *zi)
12921292 si += ti ;
12931293 }
12941294 }
1295- return FALSE ;
1295+ return false ;
12961296
12971297L_conv :
12981298 * zr = sr ;
12991299 * zi = si ;
1300- return TRUE ;
1300+ return true ;
13011301}
13021302
1303- static void calct (Rboolean * h_s_0 )
1303+ static void calct (bool * h_s_0 )
13041304{
13051305 /* computes t = -p(s)/h(s).
13061306 * h_s_0 - logical, set true if h(s) is essentially zero. */
@@ -1322,7 +1322,7 @@ static void calct(Rboolean *h_s_0)
13221322 }
13231323}
13241324
1325- static void nexth (Rboolean h_s_0 )
1325+ static void nexth (bool h_s_0 )
13261326{
13271327 /* calculates the next shifted h polynomial.
13281328 * h_s_0 : if TRUE h(s) is essentially zero
0 commit comments