@@ -12,8 +12,8 @@ namespace opencl_kernels {
1212static constexpr const char * std_normal_lcdf_device_function
1313 = " \n "
1414 " #ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_STD_NORMAL_LCDF\n "
15- " #define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_STD_NORMAL_LCDF \n "
16- STRINGIFY (
15+ " #define "
16+ " STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_STD_NORMAL_LCDF \n " STRINGIFY(
1717 /* * \ingroup opencl_kernels
1818 * Return the log standard normal cumulative distribution function
1919 * evaluated from the scaled input `x / sqrt(2)`.
@@ -39,20 +39,18 @@ static constexpr const char* std_normal_lcdf_device_function
3939 const double x6 = pow (scaled_y, 6 );
4040 const double x8 = pow (scaled_y, 8 );
4141 const double x10 = pow (scaled_y, 10 );
42- const double temp_p
43- = 0.000658749161529837803157 + 0.0160837851487422766278 / x2
44- + 0.125781726111229246204 / x4
45- + 0.360344899949804439429 / x6
46- + 0.305326634961232344035 / x8
47- + 0.0163153871373020978498 / x10;
42+ const double temp_p = 0.000658749161529837803157
43+ + 0.0160837851487422766278 / x2
44+ + 0.125781726111229246204 / x4
45+ + 0.360344899949804439429 / x6
46+ + 0.305326634961232344035 / x8
47+ + 0.0163153871373020978498 / x10;
4848 const double temp_q
49- = -0.00233520497626869185443
50- - 0.0605183413124413191178 / x2
51- - 0.527905102951428412248 / x4
52- - 1.87295284992346047209 / x6
49+ = -0.00233520497626869185443 - 0.0605183413124413191178 / x2
50+ - 0.527905102951428412248 / x4 - 1.87295284992346047209 / x6
5351 - 2.56852019228982242072 / x8 - 1.0 / x10;
54- lcdf_n = log (0.5 * M_2_SQRTPI + (temp_p / temp_q) / x2)
55- - M_LN2 - log (-scaled_y) - x2;
52+ lcdf_n = log (0.5 * M_2_SQRTPI + (temp_p / temp_q) / x2) - M_LN2
53+ - log (-scaled_y) - x2;
5654 } else {
5755 lcdf_n = -INFINITY;
5856 }
@@ -78,11 +76,10 @@ static constexpr const char* std_normal_lcdf_device_function
7876 t = 1.0 / (1.0 + 0.3275911 * scaled_y);
7977 t2 = t * t;
8078 t4 = pow (t, 4 );
81- dnlcdf
82- = 0.5 * M_2_SQRTPI
83- / (exp (x2) - 0.254829592 + 0.284496736 * t
84- - 1.421413741 * t2 + 1.453152027 * t2 * t
85- - 1.061405429 * t4);
79+ dnlcdf = 0.5 * M_2_SQRTPI
80+ / (exp (x2) - 0.254829592 + 0.284496736 * t
81+ - 1.421413741 * t2 + 1.453152027 * t2 * t
82+ - 1.061405429 * t4);
8683 } else if (scaled_y > 2.5 ) {
8784 t = scaled_y - 2.7 ;
8885 t2 = t * t;
@@ -95,46 +92,41 @@ static constexpr const char* std_normal_lcdf_device_function
9592 t = scaled_y - 2.3 ;
9693 t2 = t * t;
9794 t4 = pow (t, 4 );
98- dnlcdf = 0.002846135439 - 0.01310032351 * t
99- + 0.02732189391 * t2 - 0.03326906904 * t2 * t
100- + 0.02482478940 * t4 - 0.009883071924 * t4 * t
101- - 0.0002771362254 * pow (t, 6 );
95+ dnlcdf = 0.002846135439 - 0.01310032351 * t + 0.02732189391 * t2
96+ - 0.03326906904 * t2 * t + 0.02482478940 * t4
97+ - 0.009883071924 * t4 * t - 0.0002771362254 * pow (t, 6 );
10298 } else if (scaled_y > 1.5 ) {
10399 t = scaled_y - 1.85 ;
104100 t2 = t * t;
105101 t4 = pow (t, 4 );
106- dnlcdf = 0.01849212058 - 0.06876280470 * t
107- + 0.1099906382 * t2 - 0.09274533184 * t2 * t
108- + 0.03543327418 * t4 + 0.005644855518 * t4 * t
109- - 0.01111434424 * pow (t, 6 );
102+ dnlcdf = 0.01849212058 - 0.06876280470 * t + 0.1099906382 * t2
103+ - 0.09274533184 * t2 * t + 0.03543327418 * t4
104+ + 0.005644855518 * t4 * t - 0.01111434424 * pow (t, 6 );
110105 } else if (scaled_y > 0.8 ) {
111106 t = scaled_y - 1.15 ;
112107 t2 = t * t;
113108 t4 = pow (t, 4 );
114- dnlcdf = 0.1585747034 - 0.3898677543 * t
115- + 0.3515963775 * t2 - 0.09748053605 * t2 * t
116- - 0.04347986191 * t4 + 0.02182506378 * t4 * t
117- + 0.01074751427 * pow (t, 6 );
109+ dnlcdf = 0.1585747034 - 0.3898677543 * t + 0.3515963775 * t2
110+ - 0.09748053605 * t2 * t - 0.04347986191 * t4
111+ + 0.02182506378 * t4 * t + 0.01074751427 * pow (t, 6 );
118112 } else if (scaled_y > 0.1 ) {
119113 t = scaled_y - 0.45 ;
120114 t2 = t * t;
121115 t4 = pow (t, 4 );
122- dnlcdf = 0.6245634904 - 0.9521866949 * t
123- + 0.3986215682 * t2 + 0.04700850676 * t2 * t
124- - 0.03478651979 * t4 - 0.01772675404 * t4 * t
125- + 0.0006577254811 * pow (t, 6 );
116+ dnlcdf = 0.6245634904 - 0.9521866949 * t + 0.3986215682 * t2
117+ + 0.04700850676 * t2 * t - 0.03478651979 * t4
118+ - 0.01772675404 * t4 * t + 0.0006577254811 * pow (t, 6 );
126119 } else if (10.0 * log (fabs (scaled_y)) < log (DBL_MAX)) {
127120 t = 1.0 / (1.0 - 0.3275911 * scaled_y);
128121 t2 = t * t;
129122 t4 = pow (t, 4 );
130123 dnlcdf
131124 = M_2_SQRTPI
132- / (0.254829592 * t - 0.284496736 * t2
133- + 1.421413741 * t2 * t - 1.453152027 * t4
134- + 1.061405429 * t4 * t);
125+ / (0.254829592 * t - 0.284496736 * t2 + 1.421413741 * t2 * t
126+ - 1.453152027 * t4 + 1.061405429 * t4 * t);
135127 if (scaled_y < -29.0 ) {
136- dnlcdf += 0.0015065154280332 * x2 - 0.3993154819705530 * scaled_y
137- - 4.2919418242931700 ;
128+ dnlcdf += 0.0015065154280332 * x2
129+ - 0.3993154819705530 * scaled_y - 4.2919418242931700 ;
138130 } else if (scaled_y < -17.0 ) {
139131 dnlcdf += 0.0001263257217272 * x2 * scaled_y
140132 + 0.0123586859488623 * x2
0 commit comments