mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Merge pull request #57199 from rschu1ze/docs-math-funcs
Docs: Improve math function docs
This commit is contained in:
commit
4088ec0eac
@ -6,11 +6,9 @@ sidebar_label: Mathematical
|
||||
|
||||
# Mathematical Functions
|
||||
|
||||
All the functions return a Float64 number. Results are generally as close to the actual result as possible, but in some cases less precise than the machine-representable number.
|
||||
|
||||
## e
|
||||
|
||||
Returns e.
|
||||
Returns e ([Euler's constant](https://en.wikipedia.org/wiki/Euler%27s_constant))
|
||||
|
||||
**Syntax**
|
||||
|
||||
@ -18,15 +16,22 @@ Returns e.
|
||||
e()
|
||||
```
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float64](../../sql-reference/data-types/float.md).
|
||||
|
||||
## pi
|
||||
|
||||
Returns π.
|
||||
Returns π ([Pi](https://en.wikipedia.org/wiki/Pi)).
|
||||
|
||||
**Syntax**
|
||||
|
||||
```sql
|
||||
pi()
|
||||
```
|
||||
**Returned value**
|
||||
|
||||
Type: [Float64](../../sql-reference/data-types/float.md).
|
||||
|
||||
## exp
|
||||
|
||||
@ -38,6 +43,14 @@ Returns e to the power of the given argument.
|
||||
exp(x)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float*](../../sql-reference/data-types/float.md).
|
||||
|
||||
## log
|
||||
|
||||
Returns the natural logarithm of the argument.
|
||||
@ -50,6 +63,14 @@ log(x)
|
||||
|
||||
Alias: `ln(x)`
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float*](../../sql-reference/data-types/float.md).
|
||||
|
||||
## exp2
|
||||
|
||||
Returns 2 to the power of the given argument
|
||||
@ -60,6 +81,14 @@ Returns 2 to the power of the given argument
|
||||
exp2(x)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float*](../../sql-reference/data-types/float.md).
|
||||
|
||||
## intExp2
|
||||
|
||||
Like `exp` but returns a UInt64.
|
||||
@ -80,6 +109,14 @@ Returns the binary logarithm of the argument.
|
||||
log2(x)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float*](../../sql-reference/data-types/float.md).
|
||||
|
||||
## exp10
|
||||
|
||||
Returns 10 to the power of the given argument.
|
||||
@ -90,6 +127,14 @@ Returns 10 to the power of the given argument.
|
||||
exp10(x)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float*](../../sql-reference/data-types/float.md).
|
||||
|
||||
## intExp10
|
||||
|
||||
Like `exp10` but returns a UInt64.
|
||||
@ -110,6 +155,14 @@ Returns the decimal logarithm of the argument.
|
||||
log10(x)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float*](../../sql-reference/data-types/float.md).
|
||||
|
||||
## sqrt
|
||||
|
||||
Returns the square root of the argument.
|
||||
@ -118,6 +171,14 @@ Returns the square root of the argument.
|
||||
sqrt(x)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float*](../../sql-reference/data-types/float.md).
|
||||
|
||||
## cbrt
|
||||
|
||||
Returns the cubic root of the argument.
|
||||
@ -126,6 +187,14 @@ Returns the cubic root of the argument.
|
||||
cbrt(x)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float*](../../sql-reference/data-types/float.md).
|
||||
|
||||
## erf
|
||||
|
||||
If `x` is non-negative, then `erf(x / σ√2)` is the probability that a random variable having a normal distribution with standard deviation `σ` takes the value that is separated from the expected value by more than `x`.
|
||||
@ -136,6 +205,14 @@ If `x` is non-negative, then `erf(x / σ√2)` is the probability that a random
|
||||
erf(x)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float*](../../sql-reference/data-types/float.md).
|
||||
|
||||
**Example**
|
||||
|
||||
(three sigma rule)
|
||||
@ -160,6 +237,14 @@ Returns a number close to `1 - erf(x)` without loss of precision for large ‘x
|
||||
erfc(x)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float*](../../sql-reference/data-types/float.md).
|
||||
|
||||
## lgamma
|
||||
|
||||
Returns the logarithm of the gamma function.
|
||||
@ -170,6 +255,14 @@ Returns the logarithm of the gamma function.
|
||||
lgamma(x)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float*](../../sql-reference/data-types/float.md).
|
||||
|
||||
## tgamma
|
||||
|
||||
Returns the gamma function.
|
||||
@ -180,6 +273,14 @@ Returns the gamma function.
|
||||
gamma(x)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float*](../../sql-reference/data-types/float.md).
|
||||
|
||||
## sin
|
||||
|
||||
Returns the sine of the argument
|
||||
@ -190,6 +291,14 @@ Returns the sine of the argument
|
||||
sin(x)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float*](../../sql-reference/data-types/float.md).
|
||||
|
||||
## cos
|
||||
|
||||
Returns the cosine of the argument.
|
||||
@ -200,6 +309,14 @@ Returns the cosine of the argument.
|
||||
cos(x)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float*](../../sql-reference/data-types/float.md).
|
||||
|
||||
## tan
|
||||
|
||||
Returns the tangent of the argument.
|
||||
@ -210,6 +327,14 @@ Returns the tangent of the argument.
|
||||
tan(x)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float*](../../sql-reference/data-types/float.md).
|
||||
|
||||
## asin
|
||||
|
||||
Returns the arc sine of the argument.
|
||||
@ -220,6 +345,14 @@ Returns the arc sine of the argument.
|
||||
asin(x)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float*](../../sql-reference/data-types/float.md).
|
||||
|
||||
## acos
|
||||
|
||||
Returns the arc cosine of the argument.
|
||||
@ -230,6 +363,14 @@ Returns the arc cosine of the argument.
|
||||
acos(x)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float*](../../sql-reference/data-types/float.md).
|
||||
|
||||
## atan
|
||||
|
||||
Returns the arc tangent of the argument.
|
||||
@ -240,6 +381,14 @@ Returns the arc tangent of the argument.
|
||||
atan(x)
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float*](../../sql-reference/data-types/float.md).
|
||||
|
||||
## pow
|
||||
|
||||
Returns `x` to the power of `y`.
|
||||
@ -252,6 +401,15 @@ pow(x, y)
|
||||
|
||||
Alias: `power(x, y)`
|
||||
|
||||
**Arguments**
|
||||
|
||||
- `x` - [(U)Int8/16/32/64](../../sql-reference/data-types/int-uint.md) or [Float*](../../sql-reference/data-types/float.md)
|
||||
- `y` - [(U)Int8/16/32/64](../../sql-reference/data-types/int-uint.md) or [Float*](../../sql-reference/data-types/float.md)
|
||||
|
||||
**Returned value**
|
||||
|
||||
Type: [Float64](../../sql-reference/data-types/float.md).
|
||||
|
||||
## cosh
|
||||
|
||||
Returns the [hyperbolic cosine](https://in.mathworks.com/help/matlab/ref/cosh.html) of the argument.
|
||||
|
Loading…
Reference in New Issue
Block a user