Skip to content

Commit 03890d4

Browse files
authored
[DOC] Update math expression documentation (#5316)
* Minor: Math functions usage notes * Docs fmt
1 parent 79ecf94 commit 03890d4

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎docs/source/user-guide/expressions.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ expressions such as `col("a") + col("b")` to be used.
7777
| exp(x) | exponential |
7878
| floor(x) | nearest integer less than or equal to argument |
7979
| ln(x) | natural logarithm |
80+
| log(base, x) | logarithm of x for a particular base |
8081
| log10(x) | base 10 logarithm |
8182
| log2(x) | base 2 logarithm |
8283
| power(base, exponent) | base raised to the power of exponent |
@@ -87,6 +88,19 @@ expressions such as `col("a") + col("b")` to be used.
8788
| tan(x) | tangent |
8889
| trunc(x) | truncate toward zero |
8990

91+
### Math functions usage notes:
92+
93+
Unlike to some databases the math functions in Datafusion works the same way as Rust math functions, avoiding failing on corner cases e.g
94+
95+
```
96+
❯ select log(-1), log(0), sqrt(-1);
97+
+----------------+---------------+-----------------+
98+
| log(Int64(-1)) | log(Int64(0)) | sqrt(Int64(-1)) |
99+
+----------------+---------------+-----------------+
100+
| NaN | -inf | NaN |
101+
+----------------+---------------+-----------------+
102+
```
103+
90104
## Bitwise Operators
91105

92106
| Operator | Notes |

0 commit comments

Comments
 (0)