From 03e0b9e646c75e787c6e3c12b45cbc55278b9732 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Tue, 24 Sep 2024 04:33:46 +0300 Subject: [PATCH] math: document q_rsqrt --- vlib/math/q_rsqrt.v | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vlib/math/q_rsqrt.v b/vlib/math/q_rsqrt.v index 47b4864d35..ad750d0058 100644 --- a/vlib/math/q_rsqrt.v +++ b/vlib/math/q_rsqrt.v @@ -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