summaryrefslogtreecommitdiffstats
path: root/nist/special-functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'nist/special-functions.c')
-rw-r--r--nist/special-functions.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/nist/special-functions.c b/nist/special-functions.c
new file mode 100644
index 0000000..c15b7e1
--- /dev/null
+++ b/nist/special-functions.c
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include <math.h>
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ S P E C I A L F U N C T I O N S
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define LinuxorUnix
+#ifdef WIN
+#ifndef CYGWIN
+#undef LinuxorUnix
+/* same libraries are available*/
+#endif
+#endif
+
+#ifdef LinuxorUnix
+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))); }
+#endif