aboutsummaryrefslogtreecommitdiff
path: root/test/func.test
diff options
context:
space:
mode:
authordrh <>2023-06-28 12:02:48 +0000
committerdrh <>2023-06-28 12:02:48 +0000
commit8fbb335d9f73dfa61b6da3f99e3408435297b850 (patch)
tree611dcab4bc84f1fdce9bb294985dac9d23106c19 /test/func.test
parent60783f47b26fd584f8a7879697092557ecd0c613 (diff)
parentd847c73153ba7eb77a5b773a691ad0ca6b879157 (diff)
downloadsqlite-8fbb335d9f73dfa61b6da3f99e3408435297b850.tar.gz
sqlite-8fbb335d9f73dfa61b6da3f99e3408435297b850.zip
Enhance the SUM() aggregate (and related AVG() and TOTAL()) so that the running
sum is accurate to about 100 bits. FossilOrigin-Name: a915f15a916af698e0cef46c8b3e7ed11bda19349179d2d414073cd39c4cce24
Diffstat (limited to 'test/func.test')
-rw-r--r--test/func.test18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/func.test b/test/func.test
index 6ba953647..d5ba5d02a 100644
--- a/test/func.test
+++ b/test/func.test
@@ -1543,6 +1543,22 @@ do_execsql_test func-36.110 {
SELECT 123 ->> 456
} {123->>456}
-
+# 2023-06-26
+# Enhanced precision of SUM().
+#
+reset_db
+do_execsql_test func-37.100 {
+ WITH c(x) AS (VALUES(9223372036854775807),(9223372036854775807),
+ (123),(-9223372036854775807),(-9223372036854775807))
+ SELECT sum(x) FROM c;
+} {123}
+do_catchsql_test func-37.110 {
+ WITH c(x) AS (VALUES(9223372036854775807),(1))
+ SELECT sum(x) FROM c;
+} {1 {integer overflow}}
+do_catchsql_test func-37.120 {
+ WITH c(x) AS (VALUES(9223372036854775807),(100),(-101))
+ SELECT sum(x) FROM c;
+} {0 9223372036854775806}
finish_test