ldc/tests/codegen/complex_identity_gh2918.d
Martin Kinkelin e5f207d137
Fix identity comparisons of complex numbers (#2993)
Obviously *both* real and imaginary parts need to be identical.
Fixes #2918.
2019-02-04 21:30:05 +01:00

17 lines
342 B
D

// RUN: %ldc -run %s
void main()
{
creal f1 = +0.0 + 0.0i;
creal f2 = +0.0 - 0.0i;
creal f3 = -0.0 + 0.0i;
creal f4 = +0.0 + 0.0i;
assert(f1 !is f2);
assert(f1 !is f3);
assert(f2 !is f3);
assert(f1 is f4);
assert(!(f1 is f2));
assert(!(f1 is f3));
assert(!(f2 is f3));
assert(!(f1 !is f4));
}