mirror of
https://github.com/vlang/v.git
synced 2025-08-05 10:47:11 -04:00
math: add missing docstrings for vlib/math functions (#19617)
This commit is contained in:
parent
c526c6f3a2
commit
65dd69c5d9
@ -53,6 +53,7 @@ pub fn is_inf(f f64, sign int) bool {
|
|||||||
return (sign >= 0 && f > max_f64) || (sign <= 0 && f < -max_f64)
|
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 {
|
pub fn is_finite(f f64) bool {
|
||||||
return !is_nan(f) && !is_inf(f, 0)
|
return !is_nan(f) && !is_inf(f, 0)
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ pub mut:
|
|||||||
im f64
|
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 {
|
pub fn complex(re f64, im f64) Complex {
|
||||||
return Complex{re, im}
|
return Complex{re, im}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
module math
|
module math
|
||||||
|
|
||||||
import math.internal
|
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 {
|
pub fn acosh(x f64) f64 {
|
||||||
if x == 0.0 {
|
if x == 0.0 {
|
||||||
return 0.0
|
return 0.0
|
||||||
|
@ -469,6 +469,9 @@ pub fn skew_mean_stddev[T](data []T, mean T, sd T) T {
|
|||||||
return skew
|
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 {
|
pub fn quantile[T](sorted_data []T, f T) T {
|
||||||
if sorted_data.len == 0 {
|
if sorted_data.len == 0 {
|
||||||
return T(0)
|
return T(0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user