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

x/web3/types/bignumber.d.ts>BigNumber#integerValue

Deno / TypeScript to Ethereum Connector
Latest
method BigNumber.prototype.integerValue
import { BigNumber } from "https://deno.land/x/web3@v0.11.1/types/bignumber.d.ts";

Returns a BigNumber whose value is the value of this BigNumber rounded to an integer using rounding mode rm.

If rm is omitted, or is null or undefined, ROUNDING_MODE is used.

Throws if rm is invalid.

x = new BigNumber(123.456)
x.integerValue()                        // '123'
x.integerValue(BigNumber.ROUND_CEIL)    // '124'
y = new BigNumber(-12.7)
y.integerValue()                        // '-13'
x.integerValue(BigNumber.ROUND_DOWN)    // '-12'

Parameters

optional
rm: BigNumber.RoundingMode