fn bitwiseEqual(comptime T: type, x: T, y: T) bool T: typex: Ty: T321
322
323
324
325fn bitwiseEqual(comptime T: type, x: T, y: T) bool {
comptime assert(@typeInfo(T) == .float);
const Bits = @Int(.unsigned, @bitSizeOf(T));
return @as(Bits, @bitCast(x)) == @as(Bits, @bitCast(y));
}
Helps ensure that 0.0 doesn't compare equal to -0.0.