isIdentical

Is the binary representation of x identical to y?

@trusted pure nothrow @nogc
bool
isIdentical
(
real x
,
real y
)

Examples

// We're forcing the CTFE to run by assigning the result of the function to an enum
enum test1 = isIdentical(1.0,1.0);
enum test2 = isIdentical(real.nan,real.nan);
enum test3 = isIdentical(real.infinity, real.infinity);
enum test4 = isIdentical(real.infinity, real.infinity);
enum test5 = isIdentical(0.0, 0.0);

assert(test1);
assert(test2);
assert(test3);
assert(test4);
assert(test5);

enum test6 = !isIdentical(0.0, -0.0);
enum test7 = !isIdentical(real.nan, -real.nan);
enum test8 = !isIdentical(real.infinity, -real.infinity);

assert(test6);
assert(test7);
assert(test8);

Meta