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);
auto x = BigInt("0x1abc_de80_0000_0000_0000_0000_0000_0000"); BigInt y = x - 1; BigInt z = x + 1; double d = 0x1.abcde8p124; assert(y < d); assert(z > d); assert(x >= d && x <= d); // Note that when comparing a BigInt to a float or double the // full precision of the BigInt is always considered, unlike // when comparing an int to a float or a long to a double. assert(BigInt(123456789) < cast(float) 123456789);
Implements 3-way comparisons of BigInt with BigInt or BigInt with built-in numeric types.