1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Fix the AVG() and TOTAL() functions (after the SUM() fix of [77d3dcd283595c52])

so that they work with infinitites.  Fixes a bug introduced by check-in.
[c63e26e705f5e967].  Bug reported by
[forum:/forumpost/8960fb40cc|forum post 8960fb40cc].

FossilOrigin-Name: 6df6f17ccb404c648076ccff4200d0eb5437f0e3e82424bf3da5ea682b107bb4
This commit is contained in:
drh
2023-08-30 16:03:27 +00:00
parent 85a05d895a
commit 7bb5a6db40
4 changed files with 16 additions and 14 deletions

View File

@ -1549,8 +1549,8 @@ do_catchsql_test func-37.120 {
# Incorrect handling of infinity by SUM().
#
do_execsql_test func-38.100 {
WITH t1(x) AS (VALUES(9e+999)) SELECT sum(x) FROM t1;
WITH t1(x) AS (VALUES(-9e+999)) SELECT sum(x) FROM t1;
} {Inf -Inf}
WITH t1(x) AS (VALUES(9e+999)) SELECT sum(x), avg(x), total(x) FROM t1;
WITH t1(x) AS (VALUES(-9e+999)) SELECT sum(x), avg(x), total(x) FROM t1;
} {Inf Inf Inf -Inf -Inf -Inf}
finish_test