@@ -221,14 +221,15 @@ enum real SQRT2PI = 2.50662827463100050241576528481104525L; // sqrt(2pi)
221221// /
222222enum real SQRT2PIINV = 1 / SQRT2PI ; // 1 / sqrt(2pi)
223223
224- private :
224+ package (mir) {
225225
226226enum real EXP_2 = 0.135335283236612691893999494972484403L ; /* exp(-2) */
227227
228228// /
229229enum T MAXLOG (T) = log(T.max);
230230// /
231231enum T MINLOG (T) = log(T.min_normal * T.epsilon); // log(smallest denormal);
232+ }
232233
233234/**
234235 * Exponential of squared argument
@@ -244,6 +245,7 @@ enum T MINLOG(T) = log(T.min_normal * T.epsilon); // log(smallest denormal);
244245 * arithmetic domain # trials peak rms
245246 * IEEE -106.566, 106.566 10^5 1.6e-19 4.4e-20
246247 */
248+ package (mir)
247249T expx2 (T)(const T x_, int sign)
248250{
249251 /*
@@ -285,7 +287,7 @@ T expx2(T)(const T x_, int sign)
285287 exp(x^2) erfc(x)
286288 valid for x > 1.
287289 Use with ndtrl and expx2l. */
288-
290+ package (mir)
289291T erfce (T)(const T x)
290292{
291293 T y = 1 / x;
@@ -317,6 +319,8 @@ private T poly(alias vec, T)(const T x)
317319 return y;
318320}
319321
322+ private {
323+
320324/* erfc(x) = exp(-x^2) P(1/x)/Q(1/x)
321325 1/8 <= 1/x <= 1
322326 Peak relative error 5.8e-21 */
@@ -357,6 +361,9 @@ immutable real[7] U = [ 0x1.dde6025c395ae34ep+19, 0x1.c4bc8b6235df35aap+18,
357361 0x1 .6a0fed103f1c68a6p+ 5 , 1.0
358362];
359363
364+ }
365+
366+ package (mir)
360367F erf (F)(const F x)
361368 if (isFloatingPoint! F)
362369{
@@ -389,6 +396,7 @@ F erf(F)(const F x)
389396 * A special function expx2(x) is used to suppress error amplification
390397 * in computing exp(-x^2).
391398 */
399+ package (mir)
392400T erfc (T)(const T a)
393401{
394402 if (a == T.infinity)
@@ -430,6 +438,8 @@ T erfc(T)(const T a)
430438 return y;
431439}
432440
441+ private :
442+
433443static immutable real [8 ] P0 =
434444[ - 0x1 .758f4d969484bfdcp- 7 , 0x1 .53cee17a59259dd2p- 3 ,
435445- 0x1 .ea01e4400a9427a2p- 1 , 0x1 .61f7504a0105341ap+ 1 , - 0x1 .09475a594d0399f6p+ 2 ,
0 commit comments