On Fri, 27 Jan 2012, Dirk Eddelbuettel wrote:

| Dirk also pointed out (in the bug report) that you get the following
|
| ##########################################################
| int main(void)
| {
|      set_seed(0, 0);
|      cout << "one normal " << norm_rand() << endl;
| }
| ##########################################################
|
| edd@max:/tmp$ g++ -o faheem faheem.cpp -lRmath; ./faheem
| one normal -inf

Well I actually sent you a complete program of which you showed only an
incomplete part.  A better quote would have shown all:

 #define MATHLIB_STANDALONE
 #include <Rmath.h>
 #include <iostream>
 using std::cout;
 using std::endl;

 int main(void) {
     set_seed(0, 0);
     cout << "one normal " << norm_rand() << endl;
 }


That does indeed return -Inf on my Ubuntu server.  It works with other seed
values as does the rgamma which hangs only for value 0 and 0.

Yes, apologies for not including the complete code.

Btw, adding the definitions of `get_seed` and `set_seed` from
| `src/nmath/standalone/sunif.c` fixes the problem here as well.

faheem@orwell[default branch:rev 12]:~/corrmodel/bug$ ./edd one normal -1.26974

where previously it was giving -inf.
                                                       Regards, Faheem

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to