Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-354

compiler dependency in RandomDataImpl.getPoisson(double mean)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0
    • 2.1
    • None
    • jre1.5/jre1.6

    Description

      Hi,

      in RandomDataImpl.getPoisson(double mean) I got the following problem in the case mean>= 6.0:

      in the branch if (u <= c1):

      if (x < -mu)
      w = Double.POSITIVE_INFINITY;

      implicits that (int) (mu+ x) < 0

      I found that for some compiler/run-time environments the subsequent update of the "accept" value then fails, as by the right hand side of the comparison leads to an Exception in MathUtils.factorialLog((int) (mu + x)). Some compiler/jre combinations, however, skip evaluating the right side as by isInfinity(w).

      To ensure stability, I currently worked around by an explicit if(Double.isInfinity(w)) branch, however, I would like to ask whether there is a more elegant way to ensure general functionality of that method.

      Thank you, micha.

      Attachments

        Activity

          People

            Unassigned Unassigned
            gmicha Michael Sammeth
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: