set_precision

Function set_precision 

Source
pub fn set_precision(args: &[Value]) -> Result<Value, RuntimeError>
Expand description

设置全局计算精度

§功能

对数组中的所有数字应用指定精度的四舍五入。

§参数

  • array: Array - 数字数组
  • precision: Number - 精度(小数位数)

§返回值

Array - 应用精度后的数组

§示例

Set nums [3.14159, 2.71828, 1.41421]
Set rounded SetPrecision(nums, 2)   # [3.14, 2.72, 1.41]