BigInt.toInt

struct BigInt
@safe pure nothrow @nogc const
int
toInt
()

Return Value

Type: int

The value of this BigInt as an int, or int.max/int.min if outside the representable range.

Examples

auto big = BigInt("5_000_000");
auto i = big.toInt();
assert(i == 5_000_000);

// Numbers that are too big to fit into an int will be clamped to int.max.
auto tooBig = BigInt("5_000_000_000");
i = tooBig.toInt();
assert(i == int.max);

Meta