Added script front-end for primer-design code
[htsworkflow.git] / htswanalysis / MACS / lib / gsl / gsl-1.11 / sys / test.c
1 /* sys/test.c
2  * 
3  * Copyright (C) 1996, 1997, 1998, 1999, 2000, 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 <stdio.h>
23 #include <gsl/gsl_math.h>
24 #include <gsl/gsl_test.h>
25 #include <gsl/gsl_ieee_utils.h>
26
27 int
28 main (void)
29 {
30   double y, y_expected;
31   int e, e_expected;
32
33   gsl_ieee_env_setup ();
34
35   /* Test for expm1 */
36
37   y = gsl_expm1 (0.0);
38   y_expected = 0.0;
39   gsl_test_rel (y, y_expected, 1e-15, "gsl_expm1(0.0)");
40
41   y = gsl_expm1 (1e-10);
42   y_expected = 1.000000000050000000002e-10;
43   gsl_test_rel (y, y_expected, 1e-15, "gsl_expm1(1e-10)");
44
45   y = gsl_expm1 (-1e-10);
46   y_expected = -9.999999999500000000017e-11;
47   gsl_test_rel (y, y_expected, 1e-15, "gsl_expm1(-1e-10)");
48
49   y = gsl_expm1 (0.1);
50   y_expected = 0.1051709180756476248117078264902;
51   gsl_test_rel (y, y_expected, 1e-15, "gsl_expm1(0.1)");
52
53   y = gsl_expm1 (-0.1);
54   y_expected = -0.09516258196404042683575094055356;
55   gsl_test_rel (y, y_expected, 1e-15, "gsl_expm1(-0.1)");
56
57   y = gsl_expm1 (10.0);
58   y_expected = 22025.465794806716516957900645284;
59   gsl_test_rel (y, y_expected, 1e-15, "gsl_expm1(10.0)");
60
61   y = gsl_expm1 (-10.0);
62   y_expected = -0.99995460007023751514846440848444;
63   gsl_test_rel (y, y_expected, 1e-15, "gsl_expm1(-10.0)");
64
65   /* Test for log1p */
66
67   y = gsl_log1p (0.0);
68   y_expected = 0.0;
69   gsl_test_rel (y, y_expected, 1e-15, "gsl_log1p(0.0)");
70
71   y = gsl_log1p (1e-10);
72   y_expected = 9.9999999995000000000333333333308e-11;
73   gsl_test_rel (y, y_expected, 1e-15, "gsl_log1p(1e-10)");
74
75   y = gsl_log1p (0.1);
76   y_expected = 0.095310179804324860043952123280765;
77   gsl_test_rel (y, y_expected, 1e-15, "gsl_log1p(0.1)");
78
79   y = gsl_log1p (10.0);
80   y_expected = 2.3978952727983705440619435779651;
81   gsl_test_rel (y, y_expected, 1e-15, "gsl_log1p(10.0)");
82
83   /* Test for gsl_hypot */
84
85   y = gsl_hypot (0.0, 0.0);
86   y_expected = 0.0;
87   gsl_test_rel (y, y_expected, 1e-15, "gsl_hypot(0.0, 0.0)");
88
89   y = gsl_hypot (1e-10, 1e-10);
90   y_expected = 1.414213562373095048801688e-10;
91   gsl_test_rel (y, y_expected, 1e-15, "gsl_hypot(1e-10, 1e-10)");
92
93   y = gsl_hypot (1e-38, 1e-38);
94   y_expected = 1.414213562373095048801688e-38;
95   gsl_test_rel (y, y_expected, 1e-15, "gsl_hypot(1e-38, 1e-38)");
96
97   y = gsl_hypot (1e-10, -1.0);
98   y_expected = 1.000000000000000000005;
99   gsl_test_rel (y, y_expected, 1e-15, "gsl_hypot(1e-10, -1)");
100
101   y = gsl_hypot (-1.0, 1e-10);
102   y_expected = 1.000000000000000000005;
103   gsl_test_rel (y, y_expected, 1e-15, "gsl_hypot(-1, 1e-10)");
104
105   y = gsl_hypot (1e307, 1e301);
106   y_expected = 1.000000000000499999999999e307;
107   gsl_test_rel (y, y_expected, 1e-15, "gsl_hypot(1e307, 1e301)");
108
109   y = gsl_hypot (1e301, 1e307);
110   y_expected = 1.000000000000499999999999e307;
111   gsl_test_rel (y, y_expected, 1e-15, "gsl_hypot(1e301, 1e307)");
112
113   y = gsl_hypot (1e307, 1e307);
114   y_expected = 1.414213562373095048801688e307;
115   gsl_test_rel (y, y_expected, 1e-15, "gsl_hypot(1e307, 1e307)");
116
117   /* Test for gsl_hypot3 */
118
119   y = gsl_hypot3 (0.0, 0.0, 0.0);
120   y_expected = 0.0;
121   gsl_test_rel (y, y_expected, 1e-15, "gsl_hypot3(0.0, 0.0, 0.0)");
122
123   y = gsl_hypot3 (1e-10, 1e-10, 1e-10);
124   y_expected = 1.732050807568877293527446e-10;
125   gsl_test_rel (y, y_expected, 1e-15, "gsl_hypot3(1e-10, 1e-10, 1e-10)");
126
127   y = gsl_hypot3 (1e-38, 1e-38, 1e-38);
128   y_expected = 1.732050807568877293527446e-38;
129   gsl_test_rel (y, y_expected, 1e-15, "gsl_hypot3(1e-38, 1e-38, 1e-38)");
130
131   y = gsl_hypot3 (1e-10, 1e-10, -1.0);
132   y_expected = 1.000000000000000000099;
133   gsl_test_rel (y, y_expected, 1e-15, "gsl_hypot3(1e-10, 1e-10, -1)");
134
135   y = gsl_hypot3 (1e-10, -1.0, 1e-10);
136   y_expected = 1.000000000000000000099;
137   gsl_test_rel (y, y_expected, 1e-15, "gsl_hypot3(1e-10, -1, 1e-10)");
138
139   y = gsl_hypot3 (-1.0, 1e-10, 1e-10);
140   y_expected = 1.000000000000000000099;
141   gsl_test_rel (y, y_expected, 1e-15, "gsl_hypot3(-1, 1e-10, 1e-10)");
142
143   y = gsl_hypot3 (1e307, 1e301, 1e301);
144   y_expected = 1.0000000000009999999999995e307;
145   gsl_test_rel (y, y_expected, 1e-15, "gsl_hypot3(1e307, 1e301, 1e301)");
146
147   y = gsl_hypot3 (1e307, 1e307, 1e307);
148   y_expected = 1.732050807568877293527446e307;
149   gsl_test_rel (y, y_expected, 1e-15, "gsl_hypot3(1e307, 1e307, 1e307)");
150
151   y = gsl_hypot3 (1e307, 1e-307, 1e-307);
152   y_expected = 1.0e307;
153   gsl_test_rel (y, y_expected, 1e-15, "gsl_hypot3(1e307, 1e-307, 1e-307)");
154
155   /* Test for acosh */
156
157   y = gsl_acosh (1.0);
158   y_expected = 0.0;
159   gsl_test_rel (y, y_expected, 1e-15, "gsl_acosh(1.0)");
160
161   y = gsl_acosh (1.1);
162   y_expected = 4.435682543851151891329110663525e-1;
163   gsl_test_rel (y, y_expected, 1e-15, "gsl_acosh(1.1)");
164
165   y = gsl_acosh (10.0);
166   y_expected = 2.9932228461263808979126677137742e0;
167   gsl_test_rel (y, y_expected, 1e-15, "gsl_acosh(10.0)");
168
169   y = gsl_acosh (1e10);
170   y_expected = 2.3718998110500402149594646668302e1;
171   gsl_test_rel (y, y_expected, 1e-15, "gsl_acosh(1e10)");
172
173   /* Test for asinh */
174
175   y = gsl_asinh (0.0);
176   y_expected = 0.0;
177   gsl_test_rel (y, y_expected, 1e-15, "gsl_asinh(0.0)");
178
179   y = gsl_asinh (1e-10);
180   y_expected = 9.9999999999999999999833333333346e-11;
181   gsl_test_rel (y, y_expected, 1e-15, "gsl_asinh(1e-10)");
182
183   y = gsl_asinh (-1e-10);
184   y_expected = -9.9999999999999999999833333333346e-11;
185   gsl_test_rel (y, y_expected, 1e-15, "gsl_asinh(1e-10)");
186
187   y = gsl_asinh (0.1);
188   y_expected = 9.983407889920756332730312470477e-2;
189   gsl_test_rel (y, y_expected, 1e-15, "gsl_asinh(0.1)");
190
191   y = gsl_asinh (-0.1);
192   y_expected = -9.983407889920756332730312470477e-2;
193   gsl_test_rel (y, y_expected, 1e-15, "gsl_asinh(-0.1)");
194
195   y = gsl_asinh (1.0);
196   y_expected = 8.8137358701954302523260932497979e-1;
197   gsl_test_rel (y, y_expected, 1e-15, "gsl_asinh(1.0)");
198
199   y = gsl_asinh (-1.0);
200   y_expected = -8.8137358701954302523260932497979e-1;
201   gsl_test_rel (y, y_expected, 1e-15, "gsl_asinh(-1.0)");
202
203   y = gsl_asinh (10.0);
204   y_expected = 2.9982229502979697388465955375965e0;
205   gsl_test_rel (y, y_expected, 1e-15, "gsl_asinh(10)");
206
207   y = gsl_asinh (-10.0);
208   y_expected = -2.9982229502979697388465955375965e0;
209   gsl_test_rel (y, y_expected, 1e-15, "gsl_asinh(-10)");
210
211   y = gsl_asinh (1e10);
212   y_expected = 2.3718998110500402149599646668302e1;
213   gsl_test_rel (y, y_expected, 1e-15, "gsl_asinh(1e10)");
214
215   y = gsl_asinh (-1e10);
216   y_expected = -2.3718998110500402149599646668302e1;
217   gsl_test_rel (y, y_expected, 1e-15, "gsl_asinh(-1e10)");
218
219   /* Test for atanh */
220
221   y = gsl_atanh (0.0);
222   y_expected = 0.0;
223   gsl_test_rel (y, y_expected, 1e-15, "gsl_atanh(0.0)");
224
225   y = gsl_atanh (1e-20);
226   y_expected = 1e-20;
227   gsl_test_rel (y, y_expected, 1e-15, "gsl_atanh(1e-20)");
228
229   y = gsl_atanh (-1e-20);
230   y_expected = -1e-20;
231   gsl_test_rel (y, y_expected, 1e-15, "gsl_atanh(-1e-20)");
232
233   y = gsl_atanh (0.1);
234   y_expected = 1.0033534773107558063572655206004e-1;
235   gsl_test_rel (y, y_expected, 1e-15, "gsl_atanh(0.1)");
236
237   y = gsl_atanh (-0.1);
238   y_expected = -1.0033534773107558063572655206004e-1;
239   gsl_test_rel (y, y_expected, 1e-15, "gsl_atanh(-0.1)");
240
241   y = gsl_atanh (0.9);
242   y_expected = 1.4722194895832202300045137159439e0;
243   gsl_test_rel (y, y_expected, 1e-15, "gsl_atanh(0.9)");
244
245   y = gsl_atanh (-0.9);
246   y_expected = -1.4722194895832202300045137159439e0;
247   gsl_test_rel (y, y_expected, 1e-15, "gsl_atanh(0.9)");
248
249   /* Test for pow_int */
250
251   y = gsl_pow_2 (-3.14);
252   y_expected = pow (-3.14, 2.0);
253   gsl_test_rel (y, y_expected, 1e-15, "gsl_pow_2(-3.14)");
254
255   y = gsl_pow_3 (-3.14);
256   y_expected = pow (-3.14, 3.0);
257   gsl_test_rel (y, y_expected, 1e-15, "gsl_pow_3(-3.14)");
258
259   y = gsl_pow_4 (-3.14);
260   y_expected = pow (-3.14, 4.0);
261   gsl_test_rel (y, y_expected, 1e-15, "gsl_pow_4(-3.14)");
262
263   y = gsl_pow_5 (-3.14);
264   y_expected = pow (-3.14, 5.0);
265   gsl_test_rel (y, y_expected, 1e-15, "gsl_pow_5(-3.14)");
266
267   y = gsl_pow_6 (-3.14);
268   y_expected = pow (-3.14, 6.0);
269   gsl_test_rel (y, y_expected, 1e-15, "gsl_pow_6(-3.14)");
270
271   y = gsl_pow_7 (-3.14);
272   y_expected = pow (-3.14, 7.0);
273   gsl_test_rel (y, y_expected, 1e-15, "gsl_pow_7(-3.14)");
274
275   y = gsl_pow_8 (-3.14);
276   y_expected = pow (-3.14, 8.0);
277   gsl_test_rel (y, y_expected, 1e-15, "gsl_pow_8(-3.14)");
278
279   y = gsl_pow_9 (-3.14);
280   y_expected = pow (-3.14, 9.0);
281   gsl_test_rel (y, y_expected, 1e-15, "gsl_pow_9(-3.14)");
282
283   {
284     int n;
285     for (n = -9; n < 10; n++)
286       {
287         y = gsl_pow_int (-3.14, n);
288         y_expected = pow (-3.14, n);
289         gsl_test_rel (y, y_expected, 1e-15, "gsl_pow_n(-3.14,%d)", n);
290       }
291   }
292
293   /* Test for ldexp */
294
295   y = gsl_ldexp (M_PI, -2);
296   y_expected = M_PI_4;
297   gsl_test_rel (y, y_expected, 1e-15, "gsl_ldexp(pi,-2)");
298
299   y = gsl_ldexp (1.0, 2);
300   y_expected = 4.000000;
301   gsl_test_rel (y, y_expected, 1e-15, "gsl_ldexp(1.0,2)");
302
303   y = gsl_ldexp (0.0, 2);
304   y_expected = 0.0;
305   gsl_test_rel (y, y_expected, 1e-15, "gsl_ldexp(0.0,2)");
306
307   y = gsl_ldexp (9.999999999999998890e-01, 1024);
308   y_expected = GSL_DBL_MAX;
309   gsl_test_rel (y, y_expected, 1e-15, "gsl_ldexp DBL_MAX");
310
311   y = gsl_ldexp (1e308, -2000);
312   y_expected = 8.7098098162172166755761e-295;
313   gsl_test_rel (y, y_expected, 1e-15, "gsl_ldexp(1e308,-2000)");
314
315   y = gsl_ldexp (GSL_DBL_MIN, 2000);
316   y_expected = 2.554675596204441378334779940e294;
317   gsl_test_rel (y, y_expected, 1e-15, "gsl_ldexp(DBL_MIN,2000)");
318
319   /* Test subnormals */
320
321   {
322     int i = 0;
323     volatile double x = GSL_DBL_MIN;
324     y_expected = 2.554675596204441378334779940e294;
325     
326     while ((x /= 2) > 0)
327       {
328         i++ ;
329         y = gsl_ldexp (x, 2000 + i);
330         gsl_test_rel (y, y_expected, 1e-15, "gsl_ldexp(DBL_MIN/2**%d,%d)",i,2000+i);
331       }
332   }
333
334
335   /* Test for frexp */
336
337   y = gsl_frexp (0.0, &e);
338   y_expected = 0;
339   e_expected = 0;
340   gsl_test_rel (y, y_expected, 1e-15, "gsl_frexp(0) fraction");
341   gsl_test_int (e, e_expected, "gsl_frexp(0) exponent");
342
343   y = gsl_frexp (M_PI, &e);
344   y_expected = M_PI_4;
345   e_expected = 2;
346   gsl_test_rel (y, y_expected, 1e-15, "gsl_frexp(pi) fraction");
347   gsl_test_int (e, e_expected, "gsl_frexp(pi) exponent");
348
349   y = gsl_frexp (2.0, &e);
350   y_expected = 0.5;
351   e_expected = 2;
352   gsl_test_rel (y, y_expected, 1e-15, "gsl_frexp(2.0) fraction");
353   gsl_test_int (e, e_expected, "gsl_frexp(2.0) exponent");
354
355   y = gsl_frexp (1.0 / 4.0, &e);
356   y_expected = 0.5;
357   e_expected = -1;
358   gsl_test_rel (y, y_expected, 1e-15, "gsl_frexp(0.25) fraction");
359   gsl_test_int (e, e_expected, "gsl_frexp(0.25) exponent");
360
361   y = gsl_frexp (1.0 / 4.0 - 4.0 * GSL_DBL_EPSILON, &e);
362   y_expected = 0.999999999999996447;
363   e_expected = -2;
364   gsl_test_rel (y, y_expected, 1e-15, "gsl_frexp(0.25-eps) fraction");
365   gsl_test_int (e, e_expected, "gsl_frexp(0.25-eps) exponent");
366
367   y = gsl_frexp (GSL_DBL_MAX, &e);
368   y_expected = 9.999999999999998890e-01;
369   e_expected = 1024;
370   gsl_test_rel (y, y_expected, 1e-15, "gsl_frexp(DBL_MAX) fraction");
371   gsl_test_int (e, e_expected, "gsl_frexp(DBL_MAX) exponent");
372
373   y = gsl_frexp (-GSL_DBL_MAX, &e);
374   y_expected = -9.999999999999998890e-01;
375   e_expected = 1024;
376   gsl_test_rel (y, y_expected, 1e-15, "gsl_frexp(-DBL_MAX) fraction");
377   gsl_test_int (e, e_expected, "gsl_frexp(-DBL_MAX) exponent");
378
379   y = gsl_frexp (GSL_DBL_MIN, &e);
380   y_expected = 0.5;
381   e_expected = -1021;
382   gsl_test_rel (y, y_expected, 1e-15, "gsl_frexp(DBL_MIN) fraction");
383   gsl_test_int (e, e_expected, "gsl_frexp(DBL_MIN) exponent");
384
385   y = gsl_frexp (-GSL_DBL_MIN, &e);
386   y_expected = -0.5;
387   e_expected = -1021;
388   gsl_test_rel (y, y_expected, 1e-15, "gsl_frexp(-DBL_MIN) fraction");
389   gsl_test_int (e, e_expected, "gsl_frexp(-DBL_MIN) exponent");
390
391   /* Test subnormals */
392
393   {
394     int i = 0;
395     volatile double x = GSL_DBL_MIN;
396     y_expected = 0.5;
397     e_expected = -1021;
398     
399     while ((x /= 2) > 0)
400       {
401         e_expected--;
402         i++ ;
403         
404         y = gsl_frexp (x, &e);
405         gsl_test_rel (y, y_expected, 1e-15, "gsl_frexp(DBL_MIN/2**%d) fraction",i);
406         gsl_test_int (e, e_expected, "gsl_frexp(DBL_MIN/2**%d) exponent", i);
407       }
408   }
409
410
411   /* Test for approximate floating point comparison */
412   {
413     double x, y;
414     int i;
415
416     x = M_PI;
417     y = 22.0 / 7.0;
418
419     /* test the basic function */
420
421     for (i = 0; i < 10; i++)
422       {
423         double tol = pow (10, -i);
424         int res = gsl_fcmp (x, y, tol);
425         gsl_test_int (res, -(i >= 4), "gsl_fcmp(%.5f,%.5f,%g)", x, y, tol);
426       }
427
428     for (i = 0; i < 10; i++)
429       {
430         double tol = pow (10, -i);
431         int res = gsl_fcmp (y, x, tol);
432         gsl_test_int (res, (i >= 4), "gsl_fcmp(%.5f,%.5f,%g)", y, x, tol);
433       }
434   }
435     
436
437 #if HAVE_IEEE_COMPARISONS
438   /* Test for isinf, isnan, finite */
439
440   {
441     double zero, one, inf, nan;
442     int s;
443
444     zero = 0.0;
445     one = 1.0;
446     inf = exp (1.0e10);
447     nan = inf / inf;
448
449     s = gsl_isinf (zero);
450     gsl_test_int (s, 0, "gsl_isinf(0)");
451
452     s = gsl_isinf (one);
453     gsl_test_int (s, 0, "gsl_isinf(1)");
454
455     s = gsl_isinf (inf);
456     gsl_test_int (s, 1, "gsl_isinf(inf)");
457
458     /* isinf(3): In glibc 2.01 and earlier, isinf() returns a
459        non-zero value (actually: 1) if x is an infinity (positive or
460        negative).  (This is all that C99 requires.) */
461
462     s = gsl_isinf (-inf);  
463     gsl_test (s == 0, "gsl_isinf(-inf) is non-zero");
464
465     s = gsl_isinf (nan);
466     gsl_test_int (s, 0, "gsl_isinf(nan)");
467
468
469     s = gsl_isnan (zero);
470     gsl_test_int (s, 0, "gsl_isnan(0)");
471
472     s = gsl_isnan (one);
473     gsl_test_int (s, 0, "gsl_isnan(1)");
474
475     s = gsl_isnan (inf);
476     gsl_test_int (s, 0, "gsl_isnan(inf)");
477
478     s = gsl_isnan (-inf);
479     gsl_test_int (s, 0, "gsl_isnan(-inf)");
480
481     s = gsl_isnan (nan);
482     gsl_test_int (s, 1, "gsl_isnan(nan)");
483
484
485     s = gsl_finite (zero);
486     gsl_test_int (s, 1, "gsl_finite(0)");
487
488     s = gsl_finite (one);
489     gsl_test_int (s, 1, "gsl_finite(1)");
490
491     s = gsl_finite (inf);
492     gsl_test_int (s, 0, "gsl_finite(inf)");
493
494     s = gsl_finite (-inf);
495     gsl_test_int (s, 0, "gsl_finite(-inf)");
496
497     s = gsl_finite (nan);
498     gsl_test_int (s, 0, "gsl_finite(nan)");
499   }
500 #endif
501
502
503   {
504     double x = gsl_fdiv (2.0, 3.0);
505     gsl_test_rel (x, 2.0 / 3.0, 4 * GSL_DBL_EPSILON, "gsl_fdiv(2,3)");
506   }
507
508
509   /* Test constants in gsl_math.h */
510
511   {
512     double x = log(M_E);
513     gsl_test_rel (x, 1.0, 4 * GSL_DBL_EPSILON, "ln(M_E)");
514   }
515   
516   {
517     double x=pow(2.0,M_LOG2E);
518     gsl_test_rel (x, exp(1.0), 4 * GSL_DBL_EPSILON, "2^M_LOG2E");
519   }
520  
521   {
522     double x=pow(10.0,M_LOG10E);
523     gsl_test_rel (x, exp(1.0), 4 * GSL_DBL_EPSILON, "10^M_LOG10E");
524   }
525
526   {
527     double x=pow(M_SQRT2, 2.0);
528     gsl_test_rel (x, 2.0, 4 * GSL_DBL_EPSILON, "M_SQRT2^2");
529   }    
530
531   {
532     double x=pow(M_SQRT1_2, 2.0);
533     gsl_test_rel (x, 1.0/2.0, 4 * GSL_DBL_EPSILON, "M_SQRT1_2");
534   }    
535
536   {
537     double x=pow(M_SQRT3, 2.0);
538     gsl_test_rel (x, 3.0, 4 * GSL_DBL_EPSILON, "M_SQRT3^2");
539   }    
540
541   {
542     double x = M_PI;
543     gsl_test_rel (x, 3.1415926535897932384626433832795, 4 * GSL_DBL_EPSILON, "M_PI");
544   }    
545
546   {
547     double x = 2 * M_PI_2;
548     gsl_test_rel (x, M_PI, 4 * GSL_DBL_EPSILON, "2*M_PI_2");
549   }    
550
551   {
552     double x = 4 * M_PI_4;
553     gsl_test_rel (x, M_PI, 4 * GSL_DBL_EPSILON, "4*M_PI_4");
554   }    
555
556   {
557     double x = pow(M_SQRTPI, 2.0);
558     gsl_test_rel (x, M_PI, 4 * GSL_DBL_EPSILON, "M_SQRTPI^2");
559   }    
560
561   {
562     double x = pow(M_2_SQRTPI, 2.0);
563     gsl_test_rel (x, 4/M_PI, 4 * GSL_DBL_EPSILON, "M_SQRTPI^2");
564   }    
565
566   {
567     double x = M_1_PI;
568     gsl_test_rel (x, 1/M_PI, 4 * GSL_DBL_EPSILON, "M_1_SQRTPI");
569   }    
570
571   {
572     double x = M_2_PI;
573     gsl_test_rel (x, 2.0/M_PI, 4 * GSL_DBL_EPSILON, "M_2_PI");
574   }    
575
576   {
577     double x = exp(M_LN10);
578     gsl_test_rel (x, 10, 4 * GSL_DBL_EPSILON, "exp(M_LN10)");
579   }    
580
581   {
582     double x = exp(M_LN2);
583     gsl_test_rel (x, 2, 4 * GSL_DBL_EPSILON, "exp(M_LN2)");
584   }    
585
586   {
587     double x = exp(M_LNPI);
588     gsl_test_rel (x, M_PI, 4 * GSL_DBL_EPSILON, "exp(M_LNPI)");
589   }    
590
591   {
592     double x = M_EULER;
593     gsl_test_rel (x, 0.5772156649015328606065120900824, 4 * GSL_DBL_EPSILON, "M_EULER");
594   }    
595
596   exit (gsl_test_summary ());
597 }