aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2023-08-28 12:20:18 +0000
committerdrh <>2023-08-28 12:20:18 +0000
commitbd953dfcadb9fe5eb3631ef131f7a250b063fa9c (patch)
tree634e1bbf8de3fdc4dcf6a103f535c25538dde95b /src
parent0d066bc8a626eb9a94ea289a78df7f825b9510d9 (diff)
downloadsqlite-bd953dfcadb9fe5eb3631ef131f7a250b063fa9c.tar.gz
sqlite-bd953dfcadb9fe5eb3631ef131f7a250b063fa9c.zip
Fix an issue with infinity handling by the SUM() function that goes back
to the extended-precision SUM() enhancement of [check-in c63e26e705f5e967]. Problem reported by [forum:/forumpost/1c06ddcacc86032a|forum post 1c06ddcacc86032a]. FossilOrigin-Name: 77d3dcd283595c52f24c07fc59ba60c9133b71c440cf3f799cf48c907c6fae3e
Diffstat (limited to 'src')
-rw-r--r--src/func.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/func.c b/src/func.c
index ca0075edc..70fda8592 100644
--- a/src/func.c
+++ b/src/func.c
@@ -1816,8 +1816,10 @@ static void sumFinalize(sqlite3_context *context){
if( p->approx ){
if( p->ovrfl ){
sqlite3_result_error(context,"integer overflow",-1);
- }else{
+ }else if( !sqlite3IsNaN(p->rErr) ){
sqlite3_result_double(context, p->rSum+p->rErr);
+ }else{
+ sqlite3_result_double(context, p->rSum);
}
}else{
sqlite3_result_int64(context, p->iSum);