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

> Kahan 보정 합산 알고리즘을 사용해 숫자의 합계를 계산합니다

# sumKahan

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

도입 버전: v1.1.0

[Kahan 보정 합산 알고리즘](https://en.wikipedia.org/wiki/Kahan_summation_algorithm)을 사용하여 숫자의 합을 계산합니다.
[`sum`](/ko/reference/functions/aggregate-functions/sum) 함수보다 느립니다.
보정은 [Float](/ko/reference/data-types/float) 타입에서만 적용됩니다.

**구문**

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

**인수**

* `x` — 입력 값. [`Integer`](/ko/reference/data-types/int-uint) 또는 [`Float`](/ko/reference/data-types/float) 또는 [`Decimal`](/ko/reference/data-types/decimal)

**반환 값**

숫자의 합을 반환합니다. [`(U)Int*`](/ko/reference/data-types/int-uint) 또는 [`Float*`](/ko/reference/data-types/float) 또는 [`Decimal`](/ko/reference/data-types/decimal)

**예시**

**Kahan 합산을 사용한 정밀도 향상 예시**

```sql title=Query theme={null}
SELECT sum(0.1), sumKahan(0.1) FROM numbers(10);
```

```response title=Response theme={null}
┌───────────sum(0.1)─┬─sumKahan(0.1)─┐
│ 0.9999999999999999 │             1 │
└────────────────────┴───────────────┘
```
