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

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

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

Returns a BigNumber whose value is the square root of the value of this BigNumber, rounded according to the current DECIMAL_PLACES and ROUNDING_MODE settings.

The return value will be correctly rounded, i.e. rounded as if the result was first calculated to an infinite number of correct digits before rounding.

x = new BigNumber(16)
x.sqrt()                  // '4'
y = new BigNumber(3)
y.sqrt()                  // '1.73205080756887729353'