RFR: JDK-8283084 RandomGenerator nextDouble(double, double) is documented incorrectly [v2]

Jim Laskey jlaskey at openjdk.java.net
Mon Apr 11 12:32:26 UTC 2022


> `default float nextFloat(float origin, float bound); ` and `default double nextDouble(double origin, double bound); ` are documented incorrectly. The default method checks (origin < bound) and (bound - origin) < +infinity. 
> 
> The exception conditions are incorrect: 
> "if {@code origin} is not finite, 
>  or {@code bound} is not finite, or {@code origin} 
>  is greater than or equal to {@code bound}" 
> 
> This is not true. Calling with -Double.MAX_VALUE and Double.MAX_VALUE satisfies the documented requirements but actually throws an exception.

Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:

  Add between

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/8109/files
  - new: https://git.openjdk.java.net/jdk/pull/8109/files/4ab6a0fd..8717dd2e

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8109&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8109&range=00-01

  Stats: 4 lines in 1 file changed: 0 ins; 0 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8109.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8109/head:pull/8109

PR: https://git.openjdk.java.net/jdk/pull/8109


More information about the core-libs-dev mailing list