Update index.js
This commit is contained in:
parent
24fb7c44ea
commit
34926fc2f4
1 changed files with 4 additions and 1 deletions
5
index.js
5
index.js
|
@ -1,4 +1,3 @@
|
||||||
//now even more amazing!
|
|
||||||
function fastInverseSqrt(number) {
|
function fastInverseSqrt(number) {
|
||||||
const threehalfs = 1.5;
|
const threehalfs = 1.5;
|
||||||
const x2 = number * 0.5;
|
const x2 = number * 0.5;
|
||||||
|
@ -6,5 +5,9 @@ function fastInverseSqrt(number) {
|
||||||
i[0] = number;
|
i[0] = number;
|
||||||
let y = new Int32Array(i.buffer);
|
let y = new Int32Array(i.buffer);
|
||||||
y = threehalfs - (x2 * y * y);
|
y = threehalfs - (x2 * y * y);
|
||||||
|
y = Math.abs(y);
|
||||||
|
y = (y / 1000000000000000000);
|
||||||
|
y = Math.round(y * 100) / 100;
|
||||||
|
y = y - .1;
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue