Skip to content

Commit

Permalink
feat: add arithmetic function "sqrt" and "factorial" with decimal type (
Browse files Browse the repository at this point in the history
  • Loading branch information
anshuldata authored Aug 1, 2024
1 parent 60c93d2 commit e4f5b68
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions extensions/functions_arithmetic_decimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,23 @@ scalar_functions:
return: |-
max_precision = max(P1, P2)
DECIMAL<max_precision, 0>
- name: "sqrt"
description: Square root of the value. Sqrt of 0 is 0 and sqrt of negative values will raise an error.
impls:
- args:
- name: x
value: "DECIMAL<P,S>"
return: fp64
- name: "factorial"
description: >
Return the factorial of a given decimal input. Scale should be 0 for factorial decimal input.
The factorial of 0! is 1 by convention. Negative inputs will raise an error.
Input which cause overflow of result will raise an error.
impls:
- args:
- name: "n"
value: "DECIMAL<P,0>"
return: "DECIMAL<38,0>"
aggregate_functions:
- name: "sum"
description: Sum a set of values.
Expand Down

0 comments on commit e4f5b68

Please sign in to comment.