bigint-isqrt

    0.2.1 • Public • Published

    bigint-isqrt

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

    NPM

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

    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
    
    

    Install

    npm i bigint-isqrt

    DownloadsWeekly Downloads

    19

    Version

    0.2.1

    License

    LGPL-3.0

    Unpacked Size

    14.6 kB

    Total Files

    6

    Last publish

    Collaborators

    • aisse-258
    • nickkolok