⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 special-functions.c

📁 随机数测试标准程序NIST
💻 C
字号:
#include <stdio.h>
#include <math.h>
#include "defs.h"
#include "externs.h"
#include "proto.h"
#include "special-functions.h"

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
                     S P E C I A L  F U N C T I O N S 
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/*
double derfc(double x)
{ double f = 1 - derf_(&x);
  return(f);
}
*/

extern double erf ( double x );

double normal(double x)
{
	double arg, result, sqrt2=1.414213562373095048801688724209698078569672;

	if (x > 0) {
		arg = x/sqrt2;
		result = 0.5 * ( 1 + erf(arg) );
	}
	else {
		arg = -x/sqrt2;
		result = 0.5 * ( 1 - erf(arg) );
	}

	return(result);
}

double normal2(double a)
{
	return (1.0-0.5*erfc(a/sqrt(2.0)));
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -