ClickHouse/docs/en/sql-reference/aggregate-functions/reference/stddevpopstable.md

1.2 KiB

slug sidebar_position
/en/sql-reference/aggregate-functions/reference/stddevpopstable 189

stddevPopStable

The result is equal to the square root of varPop. Unlike stddevPop, this function uses a numerically stable algorithm. It works slower but provides a lower computational error.

Syntax

stddevPopStable(x)

Parameters

Returned value

Square root of standard deviation of x. Float64.

Example

Query:

DROP TABLE IF EXISTS test_data;
CREATE TABLE test_data
(
    population Float64,
)
ENGINE = Log;

INSERT INTO test_data SELECT randUniform(5.5, 10) FROM numbers(1000000)

SELECT
    stddevPopStable(population) AS stddev
FROM test_data;

Result:

┌─────────────stddev─┐
│ 1.2999977786592576 │
└────────────────────┘