add docs in docs section

This commit is contained in:
zvonand 2023-03-21 14:28:47 +01:00
parent 1bd6eef9c2
commit b5b200c483
2 changed files with 70 additions and 0 deletions

View File

@ -737,6 +737,41 @@ Result:
└────────────┴───────┘ └────────────┴───────┘
``` ```
## formatDecimal
Represents a numeric value as String with exact number of fractional digits.
**Syntax**
``` sql
formatDecimal(number, num_digits)
```
**Parameters**
- `number` — Value to be represented as String, of any numeric value. [Int, UInt](/docs/en/sql-reference/data-types/int-uint.md), [Float](/docs/en/sql-reference/data-types/float.md), [Decimal](/docs/en/sql-reference/data-types/decimal.md),
- `num_digits` — Number of fractional digits [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
**Returned value**
- Input value represented as [String](/docs/en/sql-reference/data-types/string.md) with given scale.
**Example**
Query:
``` sql
SELECT formatDecimal(CAST('64.32', 'Float64'), 5);
```
Result:
```response
┌─formatDecimal(CAST('64.32', 'Float64'), 5)──┐
│ 64.32000 │
└─────────────────────────────────────────────┘
```
## reinterpretAsUInt(8\|16\|32\|64) ## reinterpretAsUInt(8\|16\|32\|64)
## reinterpretAsInt(8\|16\|32\|64) ## reinterpretAsInt(8\|16\|32\|64)

View File

@ -553,6 +553,41 @@ SELECT toFixedString('foo\0bar', 8) AS s, toStringCutToZero(s) AS s_cut;
└────────────┴───────┘ └────────────┴───────┘
``` ```
## formatDecimal
Принимает любой численный тип первым аргументом, возвращает строковое десятичное представление числа с точностью, заданной вторым аргументом.
**Синтаксис**
``` sql
formatDecimal(number, num_digits)
```
**Параметры**
- `number` — Число любого числового типа: [Int, UInt](/docs/en/sql-reference/data-types/int-uint.md), [Float](/docs/en/sql-reference/data-types/float.md), [Decimal](/docs/en/sql-reference/data-types/decimal.md),
- `num_digits` — Требуемое количество десятичных знаков после запятой, [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
**Возвращаемое значение**
- Строка ([String](/docs/en/sql-reference/data-types/string.md)), представляющая собой входное число с заданной точностью.
**Пример использования**
Запрос:
``` sql
SELECT formatDecimal(CAST('64.32', 'Float64'), 5);
```
Результат:
```response
┌─formatDecimal(CAST('64.32', 'Float64'), 5)──┐
│ 64.32000 │
└─────────────────────────────────────────────┘
```
## reinterpretAsUInt(8\|16\|32\|64) {#reinterpretasuint8163264} ## reinterpretAsUInt(8\|16\|32\|64) {#reinterpretasuint8163264}
## reinterpretAsInt(8\|16\|32\|64) {#reinterpretasint8163264} ## reinterpretAsInt(8\|16\|32\|64) {#reinterpretasint8163264}