View source code Display the source code in std/bigint.d from which this page was generated on github. 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 using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

Function std.bigint.BigInt.opCmp

Implements 3-way comparisons of BigInt with BigInt or BigInt with built-in integers.

Prototypes

int opCmp(
  const(BigInt) y
) pure nothrow @nogc const;

int opCmp(T)(
  T y
) const pure nothrow @nogc
if (isIntegral!T);

int opCmp(T)(
  T y
) const pure nothrow @nogc;

Example

auto x = BigInt("100");
auto y = BigInt("10");
int z = 50;
const int w = 200;

assert(y < x);
assert(x > z);
assert(z > y);
assert(x < w);


Authors

Don Clugston

License

Boost License 1.0.

Comments