Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bigint-isqrt

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bigint-isqrt

Square root of BigInts

  • 0.3.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

bigint-isqrt

======================

NPM

A function that returns the square root (or it's floor-ed value if the root is not an integer) of a BigInt number.

======================

example:

var sqrt = require('bigint-isqrt');

var r1 = BigInt('25');
console.log("Square root of 25 = ",sqrt(r1));//Square root of 25 = 5

r1 = BigInt('82120471531550314555681345949499512621827274120673745141541602816614526075010755373654280259022317599142038423759320355177481886719814621305828811322920076213800348341464996337890625');
console.log(sqrt(r1));//9062034624274524065844376014975805577107171799890766992670739972241112960081909332275390625n

//No error with negative numbers
//You should take care of `BigInt` to be not negative number.
//No built-in checks for this are implemented.
//This function had been made as the fastest way to count square root

r1 = BigInt('-25');
console.log(sqrt(r1));//-25n

Keywords

FAQs

Package last updated on 26 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc