round
描述
¥Description
将数字四舍五入为精度
¥Round number to precision
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
num | number | 数字 |
precision? | number | 精度(默认 0) |
返回
¥Returns
number 四舍五入的数字
¥number rounded number
示例
¥Examples
turf.round(120.4321);
//=120
turf.round(120.4321, 2);
//=120.43
安装
¥Installation
$ npm install @turf/helpers
import { round } from "@turf/helpers";
const result = round(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.round(...);