failed-fastInverseSqrtJS/index.js

11 lines
258 B
JavaScript
Raw Normal View History

2024-01-27 13:49:39 -06:00
//now even more amazing!
function fastInverseSqrt(number) {
const threehalfs = 1.5;
const x2 = number * 0.5;
let i = new Float32Array(1);
i[0] = number;
let y = new Int32Array(i.buffer);
y = threehalfs - (x2 * y * y);
return y;
2023-11-23 14:42:46 -06:00
}