3 * Copyright (C) 2003, 2007 Brian Gough
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.
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.
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.
23 #include <gsl/gsl_math.h>
24 #include <gsl/gsl_const.h>
25 #include <gsl/gsl_test.h>
27 #include <gsl/gsl_ieee_utils.h>
32 gsl_ieee_env_setup ();
34 /* Basic check to make sure the header files are functioning */
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;
41 gsl_test_rel (c, 1.0/sqrt(eps*mu), 1e-6, "speed of light (mks)");
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;
49 gsl_test_rel (ly, c * y, 1e-6, "light year (cgs)");
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;
57 gsl_test_rel (c, 1.0/sqrt(eps*mu), 1e-6, "speed of light (mksa)");
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;
65 gsl_test_rel (ly, c * y, 1e-6, "light year (cgsm)");
69 double micro = GSL_CONST_NUM_MICRO;
70 double mega = GSL_CONST_NUM_MEGA;
71 double kilo = GSL_CONST_NUM_KILO;
73 gsl_test_rel (mega/kilo, 1/(micro*kilo), 1e-10, "kilo (mega/kilo, 1/(micro*kilo))");
77 double d = GSL_CONST_MKSA_DEBYE;
78 double c = GSL_CONST_MKSA_SPEED_OF_LIGHT;
79 double desu = d * c * 1000.0;
81 gsl_test_rel (desu, 1e-18, 1e-10, "debye (esu)");
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;
91 gsl_test_rel(s, sigma, 1e-10, "stefan boltzmann constant");
95 exit (gsl_test_summary ());