Skip to main content
Module

x/denops_std/function/mod.ts>round

📚 Standard module for denops.vim
Go to Latest
function round
import { round } from "https://deno.land/x/denops_std@v6.4.0/function/mod.ts";

Round off {expr} to the nearest integral value and return it as a Float. If {expr} lies halfway between two integral values, then use the larger one (away from zero). {expr} must evaluate to a Float or a Number. Returns 0.0 if {expr} is not a Float or a Number. Examples:

echo round(0.456)

    0.0

echo round(4.5)

    5.0

echo round(-4.5)

    -5.0

Can also be used as a method:

Compute()->round()

Parameters

denops: Denops
expr: unknown

Returns

Promise<number>