Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8282665: [REDO] ByteBufferTest.java: replace endless recursion with RuntimeException in void ck(double x, double y) #7723

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -220,9 +220,9 @@ void ck(double x, double y) {
// Remember: NaN == x is false for ANY x, including if x is NaN (IEEE standard).
// Therefore, if x and y are NaN, x != y would return true, which is not what we want.
// We do not want an Exception if both are NaN.
// Hence, we only use x != y, if both are not NaN.
// Additionally, we also check if exactly one of them is NaN, via XOR (^).
if ((!Double.isNaN(x) && !Double.isNaN(y) && x != y) || (Double.isNaN(x) ^ Double.isNaN(y))) {
// Double.compare takes care of these special cases
// including NaNs, and comparing -0.0 to 0.0
if (Double.compare(x,y) != 0) {
throw new RuntimeException("expect x == y:"
+ " x = " + Double.toString(x) + ", y = " + Double.toString(y)
+ " (x = " + Long.toHexString(Double.doubleToRawLongBits(x))