Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript fast inverse square root

function Q_rsqrt(number)
{ 
    var i;
    var x2, y;
    const threehalfs = 1.5;
  
    x2 = number * 0.5;
    y = number;
  
    var buf = new ArrayBuffer(4);
    (new Float32Array(buf))[0] = number;
    i = (new Uint32Array(buf))[0];
    i = (0x5f3759df - (i >> 1));
    (new Uint32Array(buf))[0] = i;
    y = (new Float32Array(buf))[0];
    y  = y * ( threehalfs - ( x2 * y * y ) );

    return y;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: check checkbox by jquery 
Javascript :: queryselectorall in javascript to get data attribute value 
Javascript :: new line in javascript alert 
Javascript :: npm react dropdown 
Javascript :: wait until something happens javascript 
Javascript :: jquery id value input 
Javascript :: how to remove particular value in dictionary in nodehs 
Javascript :: select li element with arrow keys (up and down) using javascript 
Javascript :: remove element from array javascript by index 
Javascript :: react testing for links 
Javascript :: what is npm audit 
Javascript :: object.fromentries 
Javascript :: filter json array by key in angular 9 
Javascript :: react router route not found redirect 
Javascript :: how to get type of variable in javascript 
Javascript :: Use parseInt() in the convertToInteger function so it converts a binary number to an integer and returns it. 
Javascript :: vue 3 route params 
Javascript :: install specific version of npm for your project 
Javascript :: vowels Count js 
Javascript :: MAC addresses in JavaScript 
Javascript :: javascript filter array multiple conditions 
Javascript :: use effect react 
Javascript :: react hook form validation 
Javascript :: dynamic navigation with subitems 
Javascript :: get the last array element javascript 
Javascript :: add element into array 
Javascript :: print js 
Javascript :: array join 
Javascript :: javascript every 
Javascript :: how to add element in arry in js 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =