> ## 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.

> bfloat16 数値からなるサンプルの近似 分位点 を計算します。

# quantileBFloat16

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

導入バージョン: v21.7.0

[bfloat16](https://en.wikipedia.org/wiki/Bfloat16_floating-point_format) 数で構成される [分位点](https://en.wikipedia.org/wiki/Quantile) のサンプルの近似分位点を計算します。

`bfloat16` は、符号 1 ビット、指数 8 ビット、小数部 7 ビットを持つ浮動小数点データ型です。
この関数は、入力値を 32 ビット浮動小数点数に変換して上位 16 ビットを取り出します。次に、`bfloat16` の分位点の値を計算し、0 ビットを追加して結果を 64 ビット浮動小数点数に変換します。
この関数は、`bfloat16` の 7 ビット仮数の精度に対応する高速な分位点推定器であり、最大相対誤差は `0.78125%` (平均相対誤差は約 `0.27%`) です。

**構文**

```sql theme={null}
quantileBFloat16[(level)](expr)
```

**別名**: `medianBFloat16`

**パラメータ**

* `level` — 任意。分位点 のレベル。設定可能な値は 0 から 1 の範囲です。デフォルト値: 0.5。[`Float*`](/ja/reference/data-types/float)

**引数**

* `expr` — 数値データを含むカラム。[`(U)Int*`](/ja/reference/data-types/int-uint) または [`Float*`](/ja/reference/data-types/float)

**戻り値**

指定したレベルの近似 分位点。[`Float64`](/ja/reference/data-types/float)

**例**

**bfloat16 を使用した 分位点 の計算**

```sql title=Query theme={null}
CREATE TABLE example_table (a UInt32, b Float32) ENGINE = Memory;
INSERT INTO example_table VALUES (1, 1.001), (2, 1.002), (3, 1.003), (4, 1.004);

SELECT quantileBFloat16(0.75)(a), quantileBFloat16(0.75)(b) FROM example_table;
```

```response title=Response theme={null}
┌─quantileBFloat16(0.75)(a)─┬─quantileBFloat16(0.75)(b)─┐
│                         3 │                         1 │
└───────────────────────────┴───────────────────────────┘
```

**関連項目**

* [median](/ja/reference/functions/aggregate-functions/median)
* [quantiles](/ja/reference/functions/aggregate-functions/quantiles)
