View source code
Display the source code in std/math/traits.d from which thispage was generated on github.
Report a bug
If you spot a problem with this page, click here to create aBugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.Requires a signed-in GitHub account. This works well for small changes.If you'd like to make larger changes you may want to consider usinglocal clone.
Function std.math.traits.isIdentical
Is the binary representation of x identical to y?
bool isIdentical(
real x,
real y
) pure nothrow @nogc @trusted;
Example
// 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);
Authors
Walter Bright, Don Clugston, Conversion of CEPHES math library to D by Iain Buclaw and David Nadlinger
License
Copyright © 1999-2025 by the D Language Foundation | Page generated by ddox.