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

Return the largest integral value with magnitude less than or equal to {expr} as a Float (truncate towards zero). {expr} must evaluate to a Float or a Number. Returns 0.0 if {expr} is not a Float or a Number. Examples:

echo trunc(1.456)

    1.0

echo trunc(-5.456)

    -5.0

echo trunc(4.0)

    4.0

Can also be used as a method:

Compute()->trunc()

Parameters

denops: Denops
expr: unknown

Returns

Promise<number>