Decimal.addExponent

Add exponent and shift mantissa.

struct Decimal
const @nogc nothrow pure
addExponent
(
ubyte n
)

Parameters

n ubyte

shift value.

Return Value

Type: Decimal

shifted number.

Examples

auto price = Decimal(123456, 3);
assert(price.addExponent(0) == Decimal(123456, 3));
assert(price.addExponent(1) == Decimal(1234560, 4));
assert(price.addExponent(2) == Decimal(12345600, 5));
auto price = Decimal(-123456, 3);
assert(price.addExponent(0) == Decimal(-123456, 3));
assert(price.addExponent(1) == Decimal(-1234560, 4));
assert(price.addExponent(2) == Decimal(-12345600, 5));

Meta