framed.std.math

bigdecimal

(bigdecimal v)
Convert v to a java.math.BigDecimal, representing ratios as doubles

clamp

(clamp max-val v)
Return v, or `max-val` if v exceeds max-val

divide-some

(divide-some n div)
Zero-safe division (returns value or nil)

mean

(mean vs)
Return the arithmetic mean of vs, or nil if empty

median

(median vs)
Return the median value of vs, or nil if empty

mode

(mode vs)
Return the mode of vs, or a seq of values if vs are multi-modal
Returns nil if no mode present (all frequencies equal)

nonzero?

(nonzero? v)
Is v non-nil and non-zero?

percentage

(percentage v total)(percentage v total places)
What percent of total is v?
Can optionally specify rounding decimal places; defaults to 2

round-bigdecimal

(round-bigdecimal precision v)
Round BigDecimal `v` to specified number of significant digits

round-places

(round-places places v)
Round double `v` to specified number of decimal places

std-dev

(std-dev vs)(std-dev vs ddof)
Compute the standard deviation of `vs`. Divisor used is `n - ddof` where `ddof`
represents 'delta degrees of freedom'. By default returns an unbiased
estimate (ddof = 1). For a biased estimate, set ddof = 0

See https://en.wikipedia.org/wiki/Bessel%27s_correction
    https://en.wikipedia.org/wiki/Degrees_of_freedom_(statistics)

variance

(variance vs)(variance vs ddof)
Compute the variance of `vs`. Divisor used is `n - ddof` where `ddof` represents
'delta degrees of freedom'. By default returns an unbiased estimate (ddof = 1)
For a biased estimate, set ddof = 0

See https://en.wikipedia.org/wiki/Bessel%27s_correction
    https://en.wikipedia.org/wiki/Degrees_of_freedom_(statistics)