math: add missing docstrings for vlib/math functions (#19617)

This commit is contained in:
Sudoer 2023-10-23 01:01:12 +05:30 committed by GitHub
parent c526c6f3a2
commit 65dd69c5d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 2 deletions

View File

@ -53,6 +53,7 @@ pub fn is_inf(f f64, sign int) bool {
return (sign >= 0 && f > max_f64) || (sign <= 0 && f < -max_f64)
}
// is_finite returns true if f is finite
pub fn is_finite(f f64) bool {
return !is_nan(f) && !is_inf(f, 0)
}

View File

@ -12,7 +12,7 @@ pub mut:
im f64
}
// complex returns a complex struct with the given `re`al and `im`aginary parts
// complex returns a complex struct with the given `re`al and `im`aginary values
pub fn complex(re f64, im f64) Complex {
return Complex{re, im}
}

View File

@ -1,8 +1,8 @@
module math
import math.internal
// acosh returns the non negative area hyperbolic cosine of x
// acosh returns the non-negative area hyperbolic cosine of x
pub fn acosh(x f64) f64 {
if x == 0.0 {
return 0.0

View File

@ -469,6 +469,9 @@ pub fn skew_mean_stddev[T](data []T, mean T, sd T) T {
return skew
}
// quantile calculates quantile points
// for more reference
// https://en.wikipedia.org/wiki/Quantile
pub fn quantile[T](sorted_data []T, f T) T {
if sorted_data.len == 0 {
return T(0)