数字计算

let a: Decimal = new Decimal(1.8).ceil();
console.info("test Decimal ceil:" + a.toString()); // '2'

返回一个新的Decimal,其值是将此Decimal截断为整数部分。

let a: Decimal = new Decimal(2.5).trunc();
console.info("test Decimal trunc:" + a.toString()); // '2'

或者直接转为整数

value.toFixed(0)

保留一位小数

let num = new Decimal('3.14');
let result = num.toFixed(1); // 保留一位小数 
console.log(result); // 输出将会是 "3.1"