Added script front-end for primer-design code
[htsworkflow.git] / htswanalysis / MACS / lib / gsl / gsl-1.11 / const / test.c
1 /* const/test.c
2  * 
3  * Copyright (C) 2003, 2007 Brian Gough
4  * 
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or (at
8  * your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19
20 #include <config.h>
21 #include <stdlib.h>
22 #include <math.h>
23 #include <gsl/gsl_math.h>
24 #include <gsl/gsl_const.h>
25 #include <gsl/gsl_test.h>
26
27 #include <gsl/gsl_ieee_utils.h>
28
29 int
30 main (void)
31 {
32   gsl_ieee_env_setup ();
33
34   /* Basic check to make sure the header files are functioning */
35
36   {
37     double c = GSL_CONST_MKS_SPEED_OF_LIGHT;
38     double eps = GSL_CONST_MKS_VACUUM_PERMITTIVITY;
39     double mu = GSL_CONST_MKS_VACUUM_PERMEABILITY;
40
41     gsl_test_rel (c, 1.0/sqrt(eps*mu), 1e-6, "speed of light (mks)");
42   }
43
44   {
45     double ly = GSL_CONST_CGS_LIGHT_YEAR;
46     double c = GSL_CONST_CGS_SPEED_OF_LIGHT;
47     double y = 365.2425 * GSL_CONST_CGS_DAY;
48     
49     gsl_test_rel (ly, c * y, 1e-6, "light year (cgs)");
50   }
51
52   {
53     double c = GSL_CONST_MKSA_SPEED_OF_LIGHT;
54     double eps = GSL_CONST_MKSA_VACUUM_PERMITTIVITY;
55     double mu = GSL_CONST_MKSA_VACUUM_PERMEABILITY;
56
57     gsl_test_rel (c, 1.0/sqrt(eps*mu), 1e-6, "speed of light (mksa)");
58   }
59
60   {
61     double ly = GSL_CONST_CGSM_LIGHT_YEAR;
62     double c = GSL_CONST_CGSM_SPEED_OF_LIGHT;
63     double y = 365.2425 * GSL_CONST_CGSM_DAY;
64     
65     gsl_test_rel (ly, c * y, 1e-6, "light year (cgsm)");
66   }
67
68   {
69     double micro = GSL_CONST_NUM_MICRO;
70     double mega = GSL_CONST_NUM_MEGA;
71     double kilo = GSL_CONST_NUM_KILO;
72
73     gsl_test_rel (mega/kilo, 1/(micro*kilo), 1e-10, "kilo (mega/kilo, 1/(micro*kilo))");
74   }
75
76   {
77     double d = GSL_CONST_MKSA_DEBYE;
78     double c = GSL_CONST_MKSA_SPEED_OF_LIGHT;
79     double desu = d * c * 1000.0;
80     
81     gsl_test_rel (desu, 1e-18, 1e-10, "debye (esu)");
82   }
83
84   {
85     double k = GSL_CONST_MKSA_BOLTZMANN;
86     double c = GSL_CONST_MKSA_SPEED_OF_LIGHT;
87     double h = GSL_CONST_MKSA_PLANCKS_CONSTANT_H;
88     double s = 2 * pow(M_PI, 5.0) * pow(k, 4.0) / (15 * pow(c, 2.0) * pow(h, 3.0));
89     double sigma = GSL_CONST_MKSA_STEFAN_BOLTZMANN_CONSTANT;
90     
91     gsl_test_rel(s, sigma, 1e-10, "stefan boltzmann constant");
92   }
93
94
95   exit (gsl_test_summary ());
96 }
97