Skip to content

Commit

Permalink
Fix scaled_float test (elastic#117662)
Browse files Browse the repository at this point in the history
  • Loading branch information
lkts authored Nov 28, 2024
1 parent 3c70cd0 commit 54db947
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,13 @@ protected Number randomNumber() {

public void testEncodeDecodeExactScalingFactor() {
double v = randomValue();
assertThat(encodeDecode(1 / v, v), equalTo(1 / v));
double expected = 1 / v;
// We don't produce infinities while decoding. See #testDecodeHandlingInfinity().
if (Double.isInfinite(expected)) {
var sign = expected == Double.POSITIVE_INFINITY ? 1 : -1;
expected = sign * Double.MAX_VALUE;
}
assertThat(encodeDecode(1 / v, v), equalTo(expected));
}

/**
Expand Down

0 comments on commit 54db947

Please sign in to comment.