Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8202449

overflow handling in Random.doubles

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 19
    • None
    • core-libs
    • None
    • b26

      My colleague Louis Wasserman reports:

      Random.doubles(lowerBound, upperBound) does not behave gracefully in the presence of overflow -- specifically including when lowerBound or upperBound have magnitude in the range of Double.MAX_VALUE.

      There is a relatively simple patch: if (upperBound - lowerBound >= Double.MAX_VALUE), return a double in the range [lowerBound/2, upperBound/2) and multiply it by 2.

            rgiulietti Raffaello Giulietti
            cushon Liam Miller-Cushon
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: