GRASS Programmer's Manual  6.4.2(2012)
xinormal.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <math.h>
00003 
00004 
00005 double xinormal(double pee)
00006 {
00007     double f0, pind, pw, px;
00008     static double p[5] = { -0.322232431088, -1., -0.342242088547,
00009         -0.0204231210245, -4.53642210148e-5
00010     };
00011     static double q[5] = { 0.099348462606, 0.588581570495, 0.531103462366,
00012         0.10353775285, 0.0038560700634
00013     };
00014 
00015     pind = pee;
00016 
00017     if (pee < 1e-10)
00018         return (double)-10.0;
00019     else if (pee >= 1.0)
00020         return (double)10.0;
00021     else if (pee == 0.5)
00022         return (double)0.5;
00023     /* else */
00024 
00025     if (pee > .5)
00026         pee--;
00027 
00028     pw = sqrt(log(1 / (pee * pee)));
00029     f0 = (((pw * q[4] + q[3]) * pw + q[2]) * pw + q[1]) * pw + q[0];
00030     px = pw + ((((pw * p[4] + p[3]) * pw + p[2])
00031                 * pw + p[1]) * pw + p[0]) / f0;
00032 
00033     if (pind < .5)
00034         px = -px;
00035 
00036     return px;
00037 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines