long.js icon indicating copy to clipboard operation
long.js copied to clipboard

Square root of a number

Open VictorQueiroz opened this issue 6 years ago • 2 comments

Is it possible to use long.js library to retrieve the square root of a number?

VictorQueiroz avatar Nov 22 '18 13:11 VictorQueiroz

There's no sqrt method yet, but would make sense to provide one.

dcodeIO avatar Nov 22 '18 15:11 dcodeIO

There is an integer square root algorithm that can be ported. If you prefer Rust over C, see this implementation.

Would be good to call this API isqrt instead of sqrt to manage expectations of the output type and precision.

webmaster128 avatar Nov 02 '21 22:11 webmaster128