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 :: how to merge two object arrays in javascript 
Javascript :: javascript replaceall 
Javascript :: what is node.js 
Javascript :: react bootstrap font awesome icons 
Javascript :: how to change favicon dynamic in react js 
Javascript :: js check if a variable is an array 
Javascript :: python parse single quote json 
Javascript :: VueJS - check strings is includes in vuejs 
Javascript :: javascript check string lenght 
Javascript :: onload submit form only once 
Javascript :: apply css to iframe content javascript 
Javascript :: convert a string into an integer 
Javascript :: dynamic imports js 
Javascript :: javascript array group by id 
Javascript :: javascript combobox 
Javascript :: npm font awesome 5 angular 7 
Javascript :: count vowels in a string javascript 
Javascript :: how to validate email in node js 
Javascript :: convert an array to uppercase or lowercase js 
Javascript :: change array of object to object without index value 
Javascript :: Access child elements of a main element js 
Javascript :: check for string anagram javascript 
Javascript :: Removing Elements from End of a JavaScript Array 
Javascript :: js json parse 
Javascript :: remove element from array 
Javascript :: javascript string to number 
Javascript :: lifecycle state: defunct, not mounted 
Javascript :: join array 
Javascript :: return an object from an array javascript 
Javascript :: find max and min value in array javascript 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =