Skip to content

Commit eec40a3

Browse files
author
maechler
committed
a bit more; incl current default normal RNG
git-svn-id: https://svn.r-project.org/R/trunk@87515 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent e921c6e commit eec40a3

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/nmath/standalone/test.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* 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
44
*
55
* This program is free software; you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -35,14 +35,20 @@ int
3535
main(int argc, char** argv)
3636
{
3737
/* something to force the library to be included */
38-
qnorm(0.7, 0.0, 1.0, 0, 0);
3938
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 :
4146
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());
4448
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+
4753
return 0;
4854
}

0 commit comments

Comments
 (0)