@polkadot/util
Version:
A collection of useful utilities for @polkadot
17 lines (16 loc) • 428 B
TypeScript
import type { ToBn } from '../types.js';
import { BN } from './bn.js';
/**
* @name bnSqrt
* @summary Calculates the integer square root of a BN
* @example
* <BR>
*
* ```javascript
* import BN from 'bn.js';
* import { bnSqrt } from '@polkadot/util';
*
* bnSqrt(new BN(16)).toString(); // => '4'
* ```
*/
export declare function bnSqrt<ExtToBn extends ToBn>(value: ExtToBn | BN | bigint | string | number | null): BN;