Tanner Clary created CALCITE-5983:
-------------------------------------

             Summary: Add DIV and IEEE_DIVIDE functions (enabled in BigQuery 
library)
                 Key: CALCITE-5983
                 URL: https://issues.apache.org/jira/browse/CALCITE-5983
             Project: Calcite
          Issue Type: Improvement
            Reporter: Tanner Clary
            Assignee: Tanner Clary


BigQuery offers the DIV function 
([docs|https://cloud.google.com/bigquery/docs/reference/standard-sql/mathematical_functions#div])
 and the IEEE_DIVIDE function 
([docs|https://cloud.google.com/bigquery/docs/reference/standard-sql/mathematical_functions#ieee_divide]).
 

The {{DIV(x, y)}} function returns the result of integer division of X by Y. 
Division by zero returns an error. Division by -1 may overflow.

The {{IEEE_DIVIDE(x, y)}} function divides X by Y; this function never fails. 
Returns Double. Unlike the division operator (/), this function does not 
generate errors for division by zero or overflow.

{{DIV}} examples:
1. {{DIV(20, 4)}} should return {{5}}.
2. {{DIV(2.5, 1)}} should return {{2}} because the result is floored to the 
nearest integer.
3. {{DIV(20, 0)}} should throw an error like: {{Division by zero}}.

{{IEEE_DIVIDE}} examples:
1.  {{DIV(20, 4)}} should return {{5.0}}.
2. {{DIV(20, 0)}} should return {{Infinity}}.
3. {{DIV(0, 0)}} should return {{NaN}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to