| ... | ... | @@ -63,6 +63,13 @@ test "bug 920 fixed" { |
| 63 | 63 | }; |
| 64 | 64 | |
| 65 | 65 | for (NormalDist1.f) |_, i| { |
| 66 | | try std.testing.expectEqual(NormalDist1.f[i], NormalDist.f[i]); |
| 66 | // Here we use `expectApproxEqAbs` instead of `expectEqual` to account for the small |
| 67 | // differences in math functions of different libcs. For example, if the compiler |
| 68 | // links against glibc, but the target is musl libc, then these values might be |
| 69 | // slightly different. |
| 70 | // Arguably, this is a bug in the compiler because comptime should emulate the target, |
| 71 | // including rounding errors in libc math functions. However that behavior is not |
| 72 | // what this particular test is intended to cover. |
| 73 | try std.testing.expectApproxEqAbs(NormalDist1.f[i], NormalDist.f[i], @sqrt(std.math.floatEps(f64))); |
| 67 | 74 | } |
| 68 | 75 | } |