mirror of
https://github.com/vlang/v.git
synced 2025-08-03 17:57:59 -04:00
math: document q_rsqrt
This commit is contained in:
parent
c72dde20d0
commit
03e0b9e646
@ -1,5 +1,11 @@
|
||||
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]
|
||||
pub fn q_rsqrt(x f64) f64 {
|
||||
x_half := 0.5 * x
|
||||
|
Loading…
x
Reference in New Issue
Block a user