"Fossies" - the Fresh Open Source Software Archive

Member "ccmath-2.2.1/sfunc/test/tgaml.c" (21 Nov 2000, 1782 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 /*  tgaml.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:  gaml
   10 */
   11 #include "ccmath.h"
   12 #include <math.h>
   13 void main(void)
   14 { double x,y,z;
   15   printf("     Test of Gamma Function Evaluation\n");
   16   printf("    x       log(gamma(x))            gamma(x)\n");  
   17   for(x=.5; x<10.1 ; x+=.5){
   18 
   19 /* compute the logarithm of the gamma function and the gamma function */
   20     y=gaml(x); z=exp(y);
   21 
   22     printf(" %6.3f  %16.12f  %19.8f\n",x,y,z);
   23    }
   24 }
   25 /* Test output
   26 
   27      Test of Gamma Function Evaluation
   28     x       log(gamma(x))            gamma(x)
   29   0.500    0.572364942925           1.77245385
   30   1.000    0.000000000000           1.00000000
   31   1.500   -0.120782237635           0.88622693
   32   2.000    0.000000000000           1.00000000
   33   2.500    0.284682870473           1.32934039
   34   3.000    0.693147180560           2.00000000
   35   3.500    1.200973602347           3.32335097
   36   4.000    1.791759469228           6.00000000
   37   4.500    2.453736570842          11.63172840
   38   5.000    3.178053830348          24.00000000
   39   5.500    3.957813967619          52.34277778
   40   6.000    4.787491742782         120.00000000
   41   6.500    5.662562059857         287.88527782
   42   7.000    6.579251212010         720.00000000
   43   7.500    7.534364236759        1871.25430580
   44   8.000    8.525161361065        5040.00000000
   45   8.500    9.549267257301       14034.40729348
   46   9.000   10.604602902745       40320.00000000
   47   9.500   11.689333420797      119292.46199461
   48  10.000   12.801827480081      362880.00000000
   49 */