apply all-man braces in Phobos

// find common cases
sed -E "s/^(\s*)((if|static if|for|foreach|foreach_reverse|while|unittest|switch|else|version).*)\s*\{$/\1\2\n\1{/" -i **/*.d
// catch else-if
sed -E "s/^(\s*)} (else static if| if|else if|else)(.*)\s*\{$/\1}\n\1\2\3\n\1{/" -i **/*.d
// remove created trailing whitespace
sed -i 's/[ \t]*$//' **/*.d
This commit is contained in:
Sebastian Wilzbach 2016-05-31 05:30:02 +02:00
parent f276dbc06b
commit 1d34a121e9
47 changed files with 1180 additions and 537 deletions

View file

@ -124,7 +124,8 @@ real erfc(real a)
real z = -a * a;
if (z < -MAXLOG){
if (z < -MAXLOG)
{
// mtherr( "erfcl", UNDERFLOW );
if (a < 0) return 2.0;
else return 0.0;
@ -141,7 +142,8 @@ real erfc(real a)
if (a < 0.0L)
y = 2.0L - y;
if (y == 0.0) {
if (y == 0.0)
{
// mtherr( "erfcl", UNDERFLOW );
if (a < 0) return 2.0;
else return 0.0;
@ -161,9 +163,12 @@ real erfce(real x)
{
real y = 1.0/x;
if (x < 8.0) {
if (x < 8.0)
{
return rationalPoly( y, P, Q);
} else {
}
else
{
return y * rationalPoly(y*y, R, S);
}
}
@ -204,7 +209,8 @@ real erf(real x)
return x * rationalPoly(z, T, U);
}
unittest {
unittest
{
// High resolution test points.
enum real erfc0_250 = 0.723663330078125 + 1.0279753638067014931732235184287934646022E-5;
enum real erfc0_375 = 0.5958709716796875 + 1.2118885490201676174914080878232469565953E-5;
@ -283,7 +289,8 @@ real expx2(real x, int sign)
real u = m * m;
real u1 = 2 * m * f + f * f;
if (sign < 0) {
if (sign < 0)
{
u = -u;
u1 = -u1;
}
@ -325,7 +332,8 @@ real normalDistributionImpl(real a)
if ( z < 1.0 )
return 0.5L + 0.5L * erf(x);
else {
else
{
real y = 0.5L * erfce(z);
/* Multiply by exp(-x^2 / 2) */
z = expx2(a, -1);
@ -336,7 +344,8 @@ real normalDistributionImpl(real a)
}
}
unittest {
unittest
{
assert(fabs(normalDistributionImpl(1L) - (0.841344746068543))< 0.0000000000000005);
assert(isIdentical(normalDistributionImpl(NaN(0x325)), NaN(0x325)));
}
@ -420,14 +429,16 @@ static immutable real[8] Q3 =
}
int code = 1;
real y = p;
if ( y > (1.0L - EXP_2) ) {
if ( y > (1.0L - EXP_2) )
{
y = 1.0L - y;
code = 0;
}
real x, z, y2, x0, x1;
if ( y > EXP_2 ) {
if ( y > EXP_2 )
{
y = y - 0.5L;
y2 = y * y;
x = y + y * (y2 * rationalPoly( y2, P0, Q0));
@ -437,22 +448,29 @@ static immutable real[8] Q3 =
x = sqrt( -2.0L * log(y) );
x0 = x - log(x)/x;
z = 1.0L/x;
if ( x < 8.0L ) {
if ( x < 8.0L )
{
x1 = z * rationalPoly( z, P1, Q1);
} else if ( x < 32.0L ) {
}
else if ( x < 32.0L )
{
x1 = z * rationalPoly( z, P2, Q2);
} else {
}
else
{
x1 = z * rationalPoly( z, P3, Q3);
}
x = x0 - x1;
if ( code != 0 ) {
if ( code != 0 )
{
x = -x;
}
return x;
}
unittest {
unittest
{
// TODO: Use verified test points.
// The values below are from Excel 2003.
assert(fabs(normalDistributionInvImpl(0.001) - (-3.09023230616779))< 0.00000000000005);