UNPKG

937 BMarkdownView Raw
1Gives square root of value. [:running:] [:vhs:] [:package:] [:moon:] [:ledger:]<br>
2> This is part of package [extra-bigint].
3
4[extra-bigint]: https://www.npmjs.com/package/extra-bigint
5
6```javascript
7bigint.sqrt(x);
8// x: a bigint
9```
10
11```javascript
12const bigint = require('extra-bigint');
13
14bigint.sqrt(16n, 2n);
15// 4n
16
17bigint.sqrt(15n, 2n);
18// 3n
19
20bigint.sqrt(-16n, 2n);
21// null
22```
23
24### references
25
26- [Math.sqrt: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/aqrt)
27- [Integer square root](https://en.wikipedia.org/wiki/Integer_square_root)
28- [Newton's method](https://en.wikipedia.org/wiki/Newton%27s_method)
29
30[:running:]: https://npm.runkit.com/@extra-bigint/sqrt
31[:package:]: https://www.npmjs.com/package/@extra-bigint/sqrt
32[:moon:]: https://www.npmjs.com/package/@extra-bigint/sqrt.min
33[:ledger:]: https://unpkg.com/@extra-bigint/sqrt/
34[:vhs:]: https://asciinema.org/a/342779