Skip to content

Modern Math StdDev

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Math Library › Math Library › StdDev

StdDev

Returns the sample standard deviation of an array, dividing by n-1.

Syntax

StdDev( byref a as Array( of T ) ) as float64

Notes

  • n-1, like Variance. StdDevPopulation is the n form.
  • In the same units as the data, which is why it is reported where the variance is not.
  • The final square root is the one BOUNDED operation here -- accurate to a stated ulp bound rather than exact.

Examples

#import "std/numeric"
#import "std/containers"
using numeric
using containers

dim as Array( of float64 ) a = { 2.0, 4.0, 4.0, 4.0, 6.0 }

print StdDev( a )             '' 1.414213562373095
print StdDev( a ) ^ 2         '' 2 -- Variance, give or take rounding

Library: Math Library
Category: Math Library
Documented under: Members

Clone this wiki locally