Skip to main content
Version: 7.3.0

round

描述

🌐 Description

将数字四舍五入为精度

🌐 Round number to precision

参数

🌐 Parameters

名称类型描述
numnumber数字
precision?number精度 (默认 0)

返回

🌐 Returns

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(...);