Skip to main content
Latest
function fn.round
import { fn } from "https://deno.land/x/denops_lsputil@v0.9.4/deps.ts";
const { round } = fn;

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>