Skip to main content
Module

x/denops_std/function/mod.ts>float2nr

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

Convert {expr} to a Number by omitting the part after the decimal point. {expr} must evaluate to a |Float| or a Number. Returns 0 if {expr} is not a |Float| or a |Number|. When the value of {expr} is out of range for a |Number| the result is truncated to 0x7fffffff or -0x7fffffff (or when 64-bit Number support is enabled, 0x7fffffffffffffff or -0x7fffffffffffffff). NaN results in -0x80000000 (or when 64-bit Number support is enabled, -0x8000000000000000). Examples: echo float2nr(3.95) 3 echo float2nr(-23.45) -23 echo float2nr(1.0e100) 2147483647 (or 9223372036854775807) echo float2nr(-1.0e150) -2147483647 (or -9223372036854775807) echo float2nr(1.0e-100) 0 Can also be used as a |method|: Compute()->float2nr() {only available when compiled with the |+float| feature}

Parameters

denops: Denops
expr: unknown

Returns

Promise<unknown>