|
@@ -57,6 +57,7 @@
|
|
|
* @type {{add, sub, mul, div, round}}
|
|
|
*/
|
|
|
const ZhCalc = (function () {
|
|
|
+ Decimal.set({precision: 50, defaults: true});
|
|
|
/**
|
|
|
* 加法 num1 + num2
|
|
|
* @param num1
|
|
@@ -104,7 +105,7 @@ const ZhCalc = (function () {
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
function round(value, decimal) {
|
|
|
- return value ? Decimal.round(value, decimal).toNumber() : null;
|
|
|
+ return value ? new Decimal(value).toDecimalPlaces(decimal).toNumber() : null;
|
|
|
};
|
|
|
return {add, sub, mul, div, round}
|
|
|
})();
|