Iām not sure if its a bug that infinity passes. they call std.math.approxEqRel under the hood, its docs state:
Returns true if the absolute difference between them is less or equal than max(|x|, |y|) * tolerance, where tolerance is a positive number greater than zero.
so the real tolerance will be infinity * tolerance which results in infinity.
It abides by the behaviour the docs state. Whether the behaviour should change is a different discussion.
How should I test it? Do I need to do both expectApproxEqRel() and isFinite()? But now I have no way to know if the function works correctly with comptime_float:
test {
const actual = half(4.0);
// compilation error
try std.testing.expect(std.math.isFinite(actual));
}