Update index.js
This commit is contained in:
parent
7409488119
commit
24fb7c44ea
1 changed files with 9 additions and 7 deletions
16
index.js
16
index.js
|
@ -1,8 +1,10 @@
|
||||||
//wow.
|
//now even more amazing!
|
||||||
function fastInvSqrt(x) {
|
function fastInverseSqrt(number) {
|
||||||
var xhalf = 0.5 * x;
|
const threehalfs = 1.5;
|
||||||
var i = x;
|
const x2 = number * 0.5;
|
||||||
i = i * (1.5 - xhalf * i * i);
|
let i = new Float32Array(1);
|
||||||
i = i * (1.5 - xhalf * i * i);
|
i[0] = number;
|
||||||
return i;
|
let y = new Int32Array(i.buffer);
|
||||||
|
y = threehalfs - (x2 * y * y);
|
||||||
|
return y;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue