Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ddc_vim/deps.ts>fn.float2nr

Dark deno-powered completion framework for neovim/Vim8
Go to Latest
function fn.float2nr
import { fn } from "https://deno.land/x/ddc_vim@v3.8.0/deps.ts";
const { float2nr } = fn;

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()

Parameters

denops: Denops
expr: unknown

Returns

Promise<number>