RFR: 8341260: Add Float16 to jdk.incubator.vector [v2]

Andrey Turbanov aturbanov at openjdk.org
Mon Oct 21 07:59:16 UTC 2024


On Sun, 20 Oct 2024 18:59:36 GMT, Joe Darcy <darcy at openjdk.org> wrote:

>> Port of Float16 from java.lang in the lworld+fp16 branch to jdk.incubabor.vector.
>
> Joe Darcy has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove comments for intrinsics per review feedback.

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float16.java line 498:

> 496:             }
> 497:             int ql = (int) qb - (P_F16 + 3);
> 498:             BigInteger pow10 =  bigTenToThe(scale);

Suggestion:

            BigInteger pow10 = bigTenToThe(scale);

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float16.java line 1257:

> 1255:     /*package*/ static int getExponent0(short bits) {
> 1256:         // package private to be usable in java.lang.Float.
> 1257:         int bin16ExpBits     = 0x0000_7c00 & bits;     // Five exponent bits.

Suggestion:

        int bin16ExpBits = 0x0000_7c00 & bits;     // Five exponent bits.

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float16.java line 1285:

> 1283:         int exp = getExponent(f16);
> 1284: 
> 1285:         return switch(exp) {

Suggestion:

        return switch (exp) {

test/jdk/java/math/BigDecimal/DoubleFloatValueTests.java line 112:

> 110: 
> 111:     private static void checkFloat16(BigDecimal bv, Float16 exp) {
> 112:         Float16 res =  Float16.valueOf(bv); // bv.float16Value();

Suggestion:

        Float16 res = Float16.valueOf(bv); // bv.float16Value();

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21574#discussion_r1808279099
PR Review Comment: https://git.openjdk.org/jdk/pull/21574#discussion_r1808280470
PR Review Comment: https://git.openjdk.org/jdk/pull/21574#discussion_r1808280939
PR Review Comment: https://git.openjdk.org/jdk/pull/21574#discussion_r1808281322


More information about the core-libs-dev mailing list