Skip to content

Matriz88/Q_rsqrtJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Q_rsqrtJS

This is a simple JavaScript implementation of the Fast inverse square root.

Fast inverse square root, sometimes referred to as Fast InvSqrt() or by the hexadecimal constant 0x5f3759df, is an algorithm that estimates 1/√x, the reciprocal (or multiplicative inverse) of the square root of a 32-bit floating-point number x in IEEE 754 floating-point format.

The algorithm is best known for its implementation in the source code of Quake III Arena to compute angles of incidence and reflection of the light.

- Wikipedia -

Complete Wikipedia article


How to use:

Run the following from the command line:

node Q_rsqrt.js <number>

Esample (from Wikipedia):

node Q_rsqrt.js 0.15625
Output: 2.5254863388218056

About

Fast inverse square root in javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published