shiftBig

Decimal shift left. Shifts the number left by the specified number of decimal digits. If n == 0 the number is returned unchanged. If n < 0 the number is shifted right.

BigInt
shiftBig
(
BigInt num
,
int n
)

Examples

// shiftBig(BigInt)
BigInt big;
int n;
big = 12345;
n = 2;
assert(shiftBig(big, n) == 1234500);
big = 1234567890;
n = 7;
assert(shiftBig(big, n) == BigInt(12345678900000000));
big = 12;
n = 2;
assert(shiftBig(big, n) == 1200);
big = 12;
n = 4;
assert(shiftBig(big, n) == 120000);
BigInt res;
big = BigInt("9223372036854775807");
n = -10;
assert(shiftBig(big, n) == BigInt("922337203"));
big = BigInt("9223372036854775808");
n = -10;
assert(shiftBig(big, n) == BigInt("922337203"));

Meta