Document toFloat is necessary
This commit is contained in:
parent
e76f54e059
commit
44246b6709
1 changed files with 1 additions and 0 deletions
|
|
@ -125,6 +125,7 @@ proc mean*[T](x: openArray[T]): float {.noSideEffect.} =
|
||||||
proc variance*[T](x: openArray[T]): float {.noSideEffect.} =
|
proc variance*[T](x: openArray[T]): float {.noSideEffect.} =
|
||||||
## computes the variance of the elements in `x`.
|
## computes the variance of the elements in `x`.
|
||||||
## If `x` is empty, NaN is returned.
|
## If `x` is empty, NaN is returned.
|
||||||
|
## ``toFloat(x: T): float`` must be defined.
|
||||||
result = 0.0
|
result = 0.0
|
||||||
var m = mean(x)
|
var m = mean(x)
|
||||||
for i in items(x):
|
for i in items(x):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue