DIV0 and DIV0NULL: Change to results exceeding the output scale (Pending)¶

Attention

This behavior change is in the 2023_08 bundle.

For the current status of the bundle, refer to Bundle History.

For the DIV0 and DIV0NULL functions, when the result of the division operation exceeds the output scale:

Before the change

DIV0 and DIV0NULL truncate the output.

This is inconsistent with the results from using the division operator (/).

After the change

DIV0 and DIV0NULL round the output half away from zero.

This is consistent with the results from using the division operator (/).

For example, suppose that you are dividing 5 by 9:

SELECT DIV0(5, 9), DIV0NULL(5, 9), 5/9;
Copy
Before the change

DIV0 and DIV0NULL truncate the result to 0.555555, while the division operator rounds up the result to 0.555556.

+------------+----------------+----------+
| DIV0(5, 9) | DIV0NULL(5, 9) |      5/9 |
|------------+----------------+----------|
|   0.555555 |       0.555555 | 0.555556 |
+------------+----------------+----------+
After the change

DIV0, DIV0NULL, and the division operator round up the result to 0.555556.

+------------+----------------+----------+
| DIV0(5, 9) | DIV0NULL(5, 9) |      5/9 |
|------------+----------------+----------|
|   0.555556 |       0.555556 | 0.555556 |
+------------+----------------+----------+

Ref: 1400