8374785: Template Library: need to tag Float16.copySign as having non-deterministic result because of multiple NaNs with different sign bits

Reviewed-by: thartmann, qamai
This commit is contained in:
Emanuel Peter 2026-01-12 11:18:28 +00:00
parent d0aae04d61
commit 2fbe47559e

View File

@ -274,6 +274,7 @@ public final class Operations {
ops.add(Expression.make(BOOLEANS, "Boolean.logicalXor(", BOOLEANS, ", ", BOOLEANS, ")"));
// TODO: Math and other classes.
// Note: Math.copySign is non-deterministic because of NaN having encoding with sign bit set and unset.
// Make sure the list is not modifiable.
return List.copyOf(ops);
@ -294,7 +295,8 @@ public final class Operations {
ops.add(Expression.make(INTS, "Float16.compare(", FLOAT16, ",", FLOAT16, ")"));
addComparisonOperations(ops, "Float16.compare", FLOAT16);
ops.add(Expression.make(INTS, "(", FLOAT16, ").compareTo(", FLOAT16, ")"));
ops.add(Expression.make(FLOAT16, "Float16.copySign(", FLOAT16, ",", FLOAT16, ")"));
// Note: There are NaN encodings with bit set or unset.
ops.add(Expression.make(FLOAT16, "Float16.copySign(", FLOAT16, ",", FLOAT16, ")", WITH_NONDETERMINISTIC_RESULT));
ops.add(Expression.make(FLOAT16, "Float16.divide(", FLOAT16, ",", FLOAT16, ")"));
ops.add(Expression.make(BOOLEANS, "", FLOAT16, ".equals(", FLOAT16, ")"));
// Note: there are multiple NaN values with different bit representations.