From maechler@stat.math.ethz.ch  Tue May  2 11:12:24 2000
From: maechler@stat.math.ethz.ch (maechler@stat.math.ethz.ch)
Date: Tue, 2 May 2000 12:12:24 +0200 (MET DST)
Subject: [Rd] rpois hangs (PR#530)
Message-ID: <200005021012.MAA10832@pubhealth.ku.dk>

>>>>> "PD" == Peter Dalgaard BSA <p.dalgaard@biostat.ku.dk> writes:

    PD> kjetikj@astro.uio.no writes:
    >> I have come across another really strange bug in rpois.  If I do >
    >> rpois(1, 1000000 * rpois(1, 10000)) sometimes it hangs, and hangs...
    >> On my XP1000 alphaev6 workstation, it seems to happen more
    >> frequently than on other machines. I started a session on an older
    PD> ........
    >> > rpois(1, 1000000 * rpois(1, 10000)) [hanging]
    >> 
    >> I think this is strange, because I've been doing this stuff a lot
    >> lately, but usually with a rather small parameter to the second
    >> rpois.

    PD> On Intel, that consistently gives

    >> rpois(1, 1000000 * rpois(1, 10000))
    PD> [1] -2147483648

    PD> I.e. signs of integer overflow. Apparently you partly get away with
    PD> it on a 64 bit machine, but I'm not surprised you get into regimes
    PD> that are not well tested by the poor developers working on hardware
    PD> from the bygone millennium....

I'm fixing this.  It's clear in the source code (rpois.c) 
that `int's are used in places where they must overflow as soon as  
lambda > ~= .Machine$integer.max

Martin Maechler <maechler@stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO D10	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] rpois hangs (PR#530)
maechler@stat.math.ethz.ch