Update index.js

This commit is contained in:
Samuel Lord 2024-01-27 14:10:42 -06:00 committed by GitHub
parent 24fb7c44ea
commit 34926fc2f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;
} }