Skip to main content
Module

x/math/mod.ts>round

Deno module for high-precision calculations and scientific computing
Latest
function round
import { round } from "https://deno.land/x/math@v1.1.0/mod.ts";

Returns numeric whose value is the value of value rounded using rounding mode rm to a maximum of dp decimal places or if dp is negative, rounded to an integer which is a multiple of 10**-dp. Throws if dp or rm is invalid.

Parameters

value: BigSource
optional
dp: number

if dp is omitted or is undefined, the return value is the value of value rounded to a whole number.

optional
rm: RoundingMode

if rm is omitted or is undefined, the current Big.RM setting is used.

Returns

string