[Rd] nmath bug (PR#762)

spoon@hilbert.maths.utas.edu.au spoon@hilbert.maths.utas.edu.au
Fri, 8 Dec 2000 08:29:51 +0100 (MET)

	I've been playing with the standalone math library (R.1.1.1,
Redhat 7 i386), and have detected a problem with rpois.

Basically, the rejection step in rpois can result in an infinite loop.
The simplest thing I can come up with that reproduces the problem is
the following.

#include <stdio.h>
#include <math.h>
#include <time.h>

#include "Mathlib.h"

int main() {
  double d;


  for(long k=0; k<10; k++) {
    for(long k=0; k<10000; k++) d = rpois(4500);
    for(long k=0; k<250000; k++) d = rpois(100);

Fro me this prints 3 dots and then hangs.

I realize calling rpois with means this large is probably not the
wisest thing to do, nevertheless, I still consider the infinite loop
to be a bug, hence this report.

Sorry that I cannot give a simpler example than this, its taken me
quite a while to get this far, and as my debugging efforts were going
nowhere, I thought it better to throw it out to the wider community.


*  Simon Wotherspoon                               _--_|\       *
*  Maths Dept, University of Tasmania             /  Aus \      *
*  Tasmania, Australia                            \_.--._/      *
*  spoon@hilbert.maths.utas.edu.au                      v       *

r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch