#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;
for (x = -3.0; x <= 3.1; x += 0.2) {
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;
}
I2luY2x1ZGUgPG1hdGguaD4KI2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KCiNkZWZpbmUgUCAgMC40NzA0NwojZGVmaW5lIEEgIDAuMzQ4MDI0MgojZGVmaW5lIEIgLTAuMDk1ODc5OAojZGVmaW5lIEMgIDAuNzQ3ODU1NgoKZG91YmxlIGVycmZ1bmMoZG91YmxlIHopCnsKCWRvdWJsZQllcmYsIHQsIHNpZ247CgoJaWYgKHogPCAwLjApIHsKCQl6ID0gLXo7CgkJc2lnbiA9IC0xLjA7Cgl9IGVsc2UgewoJCXNpZ24gPSAxLjA7Cgl9Cgl0ID0gMS4wIC8gKDEuMCArIFAgKiB6KTsKCWVyZiA9IDEuMCAtIChBICogdCArIEIgKiB0ICogdCArIEMgKiB0ICogdCAqIHQpICogZXhwKC0oeiAqIHopKTsKCXJldHVybiBlcmYgKiBzaWduOwp9CgppbnQgbWFpbigpCnsKCWRvdWJsZQl4LCB6LCBmOwoJY2hhcglidWZbNTBdOwoJaW50CXk7CgoJbWVtc2V0KGJ1ZiwgJyonLCA1MCk7Cglmb3IgKHggPSAtMy4wOyB4IDw9IDMuMTsgeCArPSAwLjIpIHsKCQl6ID0geCAvIHBvdyhNX1BJLCAwLjUpOwoJCWYgPSAxLjAgLyAyLjAgKiAoMS4wICsgZXJyZnVuYyh6KSk7CgkJeSA9IGYgKiA1MC4wOwoJCXByaW50ZigiJSAzLjFmICU1LjNmICUuKnNcbiIsIHgsIGYsIHksIGJ1Zik7Cgl9CglyZXR1cm4gMDsKfQo=