#include <math.h>
#include <stdio.h>
#include <string.h>

#define P  0.47047
#define A  0.3480242
#define B -0.0958798
#define C  0.7478556

double errfunc(double z)
{
	double	erf, t, sign;

	if (z < 0.0) {
		z = -z;
		sign = -1.0;
	} else {
		sign = 1.0;
	}
	t = 1.0 / (1.0 + P * z);
	erf = 1.0 - (A * t + B * t * t + C * t * t * t) * exp(-(z * z));
	return erf * sign;
}

int main()
{
	double	x, z, f;
	char	buf[50];
	int	y;

	memset(buf, '*', 50);
	for (x = -3.0; x <= 3.1; x += 0.2) {
		z = x / pow(M_PI, 0.5);
		f = 1.0 / 2.0 * (1.0 + errfunc(z));
		y = f * 50.0;
		printf("% 3.1f %5.3f %.*s\n", x, f, y, buf);
	}
	return 0;
}
