"Fossies" - the Fresh Open Source Software Archive

Member "ccmath-2.2.1/statf/test/tdnorm.c" (23 Nov 2000, 1612 Bytes) of package /linux/misc/old/ccmath-2.2.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*  tdnorm.c    CCMATH mathematics library source code.
    2  *
    3  *  Copyright (C)  2000   Daniel A. Atkinson    All rights reserved.
    4  *  This code may be redistributed under the terms of the GNU library
    5  *  public license (LGPL). ( See the lgpl.license file for details.)
    6  * ------------------------------------------------------------------------
    7  */
    8 /*
    9     Test:  qnorm  pctn
   10 */
   11 #include "ccmath.h"
   12 void main(void)
   13 { double z,dz,f,d;
   14   printf("     Test of Normal Distribution\n");
   15   printf("    z         Q(z)         Pct(Q)\n");
   16   for(z= -2.5,dz=.25; z<2.6 ;z+=dz){
   17 
   18 /* compute distribution function for standard normal */
   19     f=qnorm(z);
   20 
   21 /* compute the percentage point to check the distribution */
   22     d=pctn(f);
   23 
   24     printf(" %6.2f  %12.8f  %12.8f\n",z,f,d);
   25    }
   26 }
   27 /*  Test output
   28 
   29      Test of Normal Distribution
   30     z         Q(z)         Pct(Q)
   31   -2.50    0.99379033   -2.50000000
   32   -2.25    0.98777553   -2.25000000
   33   -2.00    0.97724987   -2.00000000
   34   -1.75    0.95994084   -1.75000000
   35   -1.50    0.93319280   -1.50000000
   36   -1.25    0.89435023   -1.25000000
   37   -1.00    0.84134475   -1.00000000
   38   -0.75    0.77337265   -0.75000000
   39   -0.50    0.69146246   -0.50000000
   40   -0.25    0.59870633   -0.25000000
   41    0.00    0.50000000    0.00000000
   42    0.25    0.40129367    0.25000000
   43    0.50    0.30853754    0.50000000
   44    0.75    0.22662735    0.75000000
   45    1.00    0.15865525    1.00000000
   46    1.25    0.10564977    1.25000000
   47    1.50    0.06680720    1.50000000
   48    1.75    0.04005916    1.75000000
   49    2.00    0.02275013    2.00000000
   50    2.25    0.01222447    2.25000000
   51    2.50    0.00620967    2.50000000
   52 */