From f5c4671bfbad96bf346bd7e9a21fc4317b4959df Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Sat, 3 Dec 2022 17:00:20 +0530 Subject: Adds most of the tools --- v_windows/v/vlib/math/q_rsqrt.v | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 v_windows/v/vlib/math/q_rsqrt.v (limited to 'v_windows/v/vlib/math/q_rsqrt.v') diff --git a/v_windows/v/vlib/math/q_rsqrt.v b/v_windows/v/vlib/math/q_rsqrt.v new file mode 100644 index 0000000..570d3a3 --- /dev/null +++ b/v_windows/v/vlib/math/q_rsqrt.v @@ -0,0 +1,12 @@ +module math + +[inline] +pub fn q_rsqrt(x f64) f64 { + x_half := 0.5 * x + mut i := i64(f64_bits(x)) + i = 0x5fe6eb50c7b537a9 - (i >> 1) + mut j := f64_from_bits(u64(i)) + j *= (1.5 - x_half * j * j) + j *= (1.5 - x_half * j * j) + return j +} -- cgit v1.2.3