@0xtorch/big-decimal
Version:
An arbitrary precision Decimal type for TypeScript that extends BigInt.
13 lines • 521 B
JavaScript
import { fix } from './fix';
import { removeTrailingZeros } from './removeTrailingZeros';
export const times = (x, y, fixDecimals, rounding = 'round') => {
// adjust the decimals and multiply the values.
const decimals = x.decimals + y.decimals;
const value = x.value * y.value;
if (fixDecimals === undefined) {
// remove trailing zeros.
return removeTrailingZeros({ value, decimals });
}
return fix({ value, decimals }, fixDecimals, rounding);
};
//# sourceMappingURL=times.js.map