| author | |
| committer | |
| log | 1b6a1e691fab75ce40c9d0c4015c9f4a46b72aa4 |
| tree | cdd0aa2589adb364b8411c95a5d8d2fe71c17269 |
| parent | 0893326e0ea9b261c5d334067c294c7d8972d5a1 |
| signature |
2 files changed, 9 insertions(+), 4 deletions(-)
src/Sema.zig+7| ... | ... | @@ -15816,6 +15816,13 @@ fn cmpNumeric( |
| 15816 | 15816 | if (lhs_val.isUndef() or rhs_val.isUndef()) { |
| 15817 | 15817 | return sema.addConstUndef(Type.bool); |
| 15818 | 15818 | } |
| 15819 | if (lhs_val.isNan() or rhs_val.isNan()) { | |
| 15820 | if (op == std.math.CompareOperator.neq) { | |
| 15821 | return Air.Inst.Ref.bool_true; | |
| 15822 | } else { | |
| 15823 | return Air.Inst.Ref.bool_false; | |
| 15824 | } | |
| 15825 | } | |
| 15819 | 15826 | if (Value.compareHetero(lhs_val, op, rhs_val)) { |
| 15820 | 15827 | return Air.Inst.Ref.bool_true; |
| 15821 | 15828 | } else { |
test/behavior/math.zig+2-4| ... | ... | @@ -979,18 +979,16 @@ test "vector integer addition" { |
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | test "NaN comparison" { |
| 982 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO | |
| 983 | ||
| 984 | 982 | try testNanEqNan(f16); |
| 985 | 983 | try testNanEqNan(f32); |
| 986 | 984 | try testNanEqNan(f64); |
| 987 | 985 | try testNanEqNan(f128); |
| 988 | if (has_f80_rt) try testNanEqNan(f80); | |
| 986 | if (has_f80_rt and (builtin.zig_backend == .stage1)) try testNanEqNan(f80); // TODO | |
| 989 | 987 | comptime try testNanEqNan(f16); |
| 990 | 988 | comptime try testNanEqNan(f32); |
| 991 | 989 | comptime try testNanEqNan(f64); |
| 992 | 990 | comptime try testNanEqNan(f128); |
| 993 | // comptime try testNanEqNan(f80); | |
| 991 | // comptime try testNanEqNan(f80); // TODO | |
| 994 | 992 | } |
| 995 | 993 | |
| 996 | 994 | fn testNanEqNan(comptime F: type) !void { |