diff --git a/index.js b/index.js index 448e610..9e4e76d 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,5 @@ -function fastInverseSqrt(number) { +//fast inverse sqrt +function fisqrt(number) { const threehalfs = 1.5; const x2 = number * 0.5; let i = new Float32Array(1); @@ -11,3 +12,17 @@ function fastInverseSqrt(number) { y = Math.round(y * 100) / 100; return y; } + +//manual sqrt +function msqrt(number) { + for (var i = 0; i * i <= number; i++) { + if (i * i === number) + return i; + } + return number; +} + +//square +function sq(number) { + return number * number; +}