|
1 | 1 | /* |
2 | 2 | * Mathlib : A C Library of Special Functions |
3 | | - * Copyright (C) 2000-7 The R Core Team |
| 3 | + * Copyright (C) 2000--2025 The R Core Team |
4 | 4 | * |
5 | 5 | * This program is free software; you can redistribute it and/or modify |
6 | 6 | * it under the terms of the GNU General Public License as published by |
|
35 | 35 | main(int argc, char** argv) |
36 | 36 | { |
37 | 37 | /* something to force the library to be included */ |
38 | | - qnorm(0.7, 0.0, 1.0, 0, 0); |
39 | 38 | printf("*** loaded '%s'\n", argv[0]); |
40 | | - set_seed(123, 456); |
| 39 | + double |
| 40 | + dn = dnorm(0.7, 0., 1., 0), |
| 41 | + qn = qnorm(0.7, 0., 1., 0, 0); |
| 42 | + printf("dnorm(0.7) = %.12g\n", dn); |
| 43 | + printf("qnorm(0.7) = %.12g\n", qn); |
| 44 | + printf("pnorm(qnorm(..)) = %.12g\n", pnorm(qn, 0., 1., 0, 0)); |
| 45 | + // now _two_ of the normal.kind : |
41 | 46 | N01_kind = AHRENS_DIETER; |
42 | | - printf("one normal %f\n", norm_rand()); |
43 | | - set_seed(123, 456); |
| 47 | + set_seed(123, 456); printf("one normal %f\n", norm_rand()); |
44 | 48 | N01_kind = BOX_MULLER; |
45 | | - printf("normal via BM %f\n", norm_rand()); |
46 | | - |
| 49 | + set_seed(123, 456); printf("normal via Box_M %f\n", norm_rand()); |
| 50 | + N01_kind = INVERSION; |
| 51 | + set_seed(123, 456); printf("normal via Inv. %f\n", norm_rand()); |
| 52 | + |
47 | 53 | return 0; |
48 | 54 | } |
0 commit comments