Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add options for behaviour when dividing by zero or calculating log zero #329

Merged
merged 3 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion extensions/functions_arithmetic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ scalar_functions:
return: fp64
-
name: "divide"
description: "Divide one value by another. Partial values are truncated."
description: >
Divide x by y. In the case of integer division, partial values are truncated (i.e. rounded towards 0).
The `on_division_by_zero` option governs behavior in cases where y is 0 and x is not 0.
`LIMIT` means positive or negative infinity (depending on the sign of x and y).
If x and y are both 0 or both +/-infinity, behavior will be governed by `on_domain_error`.
impls:
- args:
- name: overflow
Expand Down Expand Up @@ -220,6 +224,9 @@ scalar_functions:
- name: on_domain_error
options: [ NAN, ERROR ]
required: false
- name: on_division_by_zero
options: [ LIMIT, NAN, ERROR ]
required: false
- name: x
value: fp32
- name: y
Expand All @@ -232,6 +239,9 @@ scalar_functions:
- name: on_domain_error
options: [ NAN, ERROR ]
required: false
- name: on_division_by_zero
options: [ LIMIT, NAN, ERROR ]
required: false
- name: x
value: fp64
- name: y
Expand Down
30 changes: 30 additions & 0 deletions extensions/functions_logarithmic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ scalar_functions:
- name: on_domain_error
options: [ NAN, ERROR ]
required: false
- name: on_log_zero
options: [NAN, ERROR, MINUS_INFINITY]
required: false
- name: x
value: fp32
return: fp32
Expand All @@ -22,6 +25,9 @@ scalar_functions:
- name: on_domain_error
options: [ NAN, ERROR ]
required: false
- name: on_log_zero
options: [NAN, ERROR, MINUS_INFINITY]
required: false
- name: x
value: fp64
return: fp64
Expand All @@ -36,6 +42,9 @@ scalar_functions:
- name: on_domain_error
options: [ NAN, ERROR ]
required: false
- name: on_log_zero
options: [NAN, ERROR, MINUS_INFINITY]
required: false
- name: x
value: fp32
return: fp32
Expand All @@ -46,6 +55,9 @@ scalar_functions:
- name: on_domain_error
options: [ NAN, ERROR ]
required: false
- name: on_log_zero
options: [NAN, ERROR, MINUS_INFINITY]
required: false
- name: x
value: fp64
return: fp64
Expand All @@ -60,6 +72,9 @@ scalar_functions:
- name: on_domain_error
options: [ NAN, ERROR ]
required: false
- name: on_log_zero
options: [NAN, ERROR, MINUS_INFINITY]
required: false
- name: x
value: fp32
return: fp32
Expand All @@ -70,6 +85,9 @@ scalar_functions:
- name: on_domain_error
options: [ NAN, ERROR ]
required: false
- name: on_log_zero
options: [NAN, ERROR, MINUS_INFINITY]
required: false
- name: x
value: fp64
return: fp64
Expand All @@ -87,6 +105,9 @@ scalar_functions:
- name: on_domain_error
options: [ NAN, ERROR ]
required: false
- name: on_log_zero
options: [NAN, ERROR, MINUS_INFINITY]
required: false
- value: fp32
name: "x"
description: "The number `x` to compute the logarithm of"
Expand All @@ -101,6 +122,9 @@ scalar_functions:
- name: on_domain_error
options: [ NAN, ERROR ]
required: false
- name: on_log_zero
options: [NAN, ERROR, MINUS_INFINITY]
required: false
- value: fp64
name: "x"
description: "The number `x` to compute the logarithm of"
Expand All @@ -122,6 +146,9 @@ scalar_functions:
- name: on_domain_error
options: [ NAN, ERROR ]
required: false
- name: on_log_zero
options: [NAN, ERROR, MINUS_INFINITY]
required: false
- name: x
value: fp32
return: fp32
Expand All @@ -132,6 +159,9 @@ scalar_functions:
- name: on_domain_error
options: [ NAN, ERROR ]
required: false
- name: on_log_zero
options: [NAN, ERROR, MINUS_INFINITY]
required: false
- name: x
value: fp64
return: fp64
Expand Down