From d681dd943804b65b3ad18015329f21e023b7871c Mon Sep 17 00:00:00 2001 From: Pratush Rai Date: Sat, 7 Oct 2023 03:57:45 +0530 Subject: [PATCH] Added docs for complex fn in vlib/math/complex and gamma.v --- vlib/math/complex/complex.v | 1 + vlib/math/gamma.v | 2 ++ 2 files changed, 3 insertions(+) diff --git a/vlib/math/complex/complex.v b/vlib/math/complex/complex.v index a2efbceda5d5d8..9b9cf77153df2e 100644 --- a/vlib/math/complex/complex.v +++ b/vlib/math/complex/complex.v @@ -12,6 +12,7 @@ pub mut: im f64 } +// Return a Complex Struct with re and im pub fn complex(re f64, im f64) Complex { return Complex{re, im} } diff --git a/vlib/math/gamma.v b/vlib/math/gamma.v index e0061db39b4749..6ad09a104ebe77 100644 --- a/vlib/math/gamma.v +++ b/vlib/math/gamma.v @@ -134,11 +134,13 @@ pub fn gamma(a f64) f64 { // log_gamma(-integer) = +inf // log_gamma(-inf) = -inf // log_gamma(nan) = nan +// uses log_gamma_sign internally pub fn log_gamma(x f64) f64 { y, _ := log_gamma_sign(x) return y } +// log_gamma_sign returns the natural logarithm and sign (-1 or +1) of Gamma(x) pub fn log_gamma_sign(a f64) (f64, int) { mut x := a ymin := 1.461632144968362245