RFR: 8211002: test/jdk/java/lang/Math/PowTests.java skips testing for non-corner-case values [v2]

Brian Burkhalter bpb at openjdk.java.net
Wed Jul 14 16:43:52 UTC 2021


On Tue, 13 Jul 2021 23:29:38 GMT, Joe Darcy <darcy at openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8211002: Change so that Tests.testUlpDiff() handles the NaNs and accepts a ulp tolerance of 2
>
> test/jdk/java/lang/Math/PowTests.java line 65:
> 
>> 63:         int failures = 0;
>> 64:         if (Double.isNaN(smResult)) {
>> 65:             if (!Double.isNaN(mResult)) failures = 1;
> 
> Pretty sure the Tests.testUlpDiff call will handle two NaNs as well as NaN/non-NaN argument.

Looks like that is true.

> test/jdk/java/lang/Math/PowTests.java line 69:
> 
>> 67:             failures += Tests.testUlpDiff(
>> 68:                 "StrictMath.pow(double, double) vs Math.pow(double, double)",
>> 69:                 input1, input2, mResult, smResult, 1.0
> 
> In theory at least, one pow method could round an ulp up and the other could round an ulp down so the difference should be 2 ulps (ignoring the special case of values straddling a power of two).

Good point.

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

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


More information about the core-libs-dev mailing list