> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8c05c8a2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> 返回总体方差。与 varPop 不同，此函数使用 数值稳定的算法。它运行较慢，但计算 误差更低。

# varPopStable

<div id="varPopStable">
  ## varPopStable
</div>

引入版本：v1.1.0

返回总体方差。
与 [`varPop`](/zh/reference/functions/aggregate-functions/varPop) 不同，此函数采用[数值稳定](https://en.wikipedia.org/wiki/Numerical_stability)算法。
虽然运行速度较慢，但计算误差更低。

**语法**

```sql theme={null}
varPopStable(x)
```

**参数**

* `x` — 用于计算总体方差的一组值。[`(U)Int*`](/zh/reference/data-types/int-uint) 或 [`Float*`](/zh/reference/data-types/float) 或 [`Decimal*`](/zh/reference/data-types/decimal)

**返回值**

返回 `x` 的总体方差。[`Float64`](/zh/reference/data-types/float)

**示例**

**计算稳定总体方差**

```sql title=Query theme={null}
DROP TABLE IF EXISTS test_data;
CREATE TABLE test_data
(
    x UInt8,
)
ENGINE = Memory;

INSERT INTO test_data VALUES (3),(3),(3),(4),(4),(5),(5),(7),(11),(15);

SELECT
    varPopStable(x) AS var_pop_stable
FROM test_data;
```

```response title=Response theme={null}
┌─var_pop_stable─┐
│           14.4 │
└────────────────┘
```
