mirror of
https://github.com/vlang/v.git
synced 2025-09-07 14:20:10 -04:00
math: document q_rsqrt
This commit is contained in:
parent
c72dde20d0
commit
03e0b9e646
@ -1,5 +1,11 @@
|
|||||||
module math
|
module math
|
||||||
|
|
||||||
|
// q_sqrt computes an approximation of the inverse square root (1 / √x) using a fast
|
||||||
|
// inverse square root algorithm. This method is often used in applications
|
||||||
|
// where performance is crucial, such as in computer graphics or physics
|
||||||
|
// simulations.
|
||||||
|
// (This algorithm is inspired by the famous "fast inverse square root" code
|
||||||
|
// used in the Quake III Arena game engine.)
|
||||||
@[inline]
|
@[inline]
|
||||||
pub fn q_rsqrt(x f64) f64 {
|
pub fn q_rsqrt(x f64) f64 {
|
||||||
x_half := 0.5 * x
|
x_half := 0.5 * x
|
||||||
|
Loading…
x
Reference in New Issue
Block a user