From 60e53c57cf873b4a0ce486a5079a3f21cd437fc4 Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 14 Sep 2023 13:10:17 +0000 Subject: [PATCH] Improve the sqlite3IntFloatCompare() routine so that it is testable. FossilOrigin-Name: bb221381fa38db5be1222d89c567a9bca0e6c441e26a8c797bd326b263556afb --- manifest | 13 ++++++------- manifest.uuid | 2 +- src/vdbeaux.c | 9 +++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 5181ab1770..ee67317737 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\snot\sset\sthe\sglobal\sbUseLongDouble\sflag\sbased\spurely\son\ssizeof(long\sdouble)\nbeing\smore\sthan\s8.\s\sThat\sis\sa\snecessary\sbut\snot\ssufficient\scondition\sto\suse\nthe\slong\sdouble\sroutines.\s\sInstead,\sdo\sa\srun-time\stest\sto\sverify\sthat\slong\ndouble\sreally\sdoes\sprovide\sextra\sprecision. -D 2023-09-14T10:46:50.776 +C Improve\sthe\ssqlite3IntFloatCompare()\sroutine\sso\sthat\sit\sis\stestable. +D 2023-09-14T13:10:17.432 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -783,7 +783,7 @@ F src/vdbe.c 2849053c8625702b324a1553836b5abfcbc1559b4e49187e745dea349fb81685 F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c F src/vdbeapi.c 4184402246172220418c0ef49ff4cf1a19ced9a4ac6c843c2f0773fb5c543f37 -F src/vdbeaux.c 1b58fc93843b04d3e96d3240e554ed9f23b2e308d3b736f1004fe2eb514a8893 +F src/vdbeaux.c 5b415e09b5b9d5be6c0f4fcbf18ea9d7d16f6a29ced2f14a3b2041020f63e9c1 F src/vdbeblob.c 2516697b3ee8154eb8915f29466fb5d4f1ae39ee8b755ea909cefaf57ec5e2ce F src/vdbemem.c 317b9f48708139db6239ade40c7980b4bc8233168383690d588dad6d8437f722 F src/vdbesort.c 0d40dca073c94e158ead752ef4225f4fee22dee84145e8c00ca2309afb489015 @@ -2120,9 +2120,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 21adb1aef24398fba918a5e1479ce2b6fd7e86d87eb9f2bea86a0eb43e8809c2 810c635ce063d873e969bf83339c654f6008e84ce8a61f0ffc61806e98d13dde -R b390e5a75fc36ea63cfccf4d34a2bd01 -T +closed 810c635ce063d873e969bf83339c654f6008e84ce8a61f0ffc61806e98d13dde +P aa999d490b743f455f2fb6c41009098330380f0bc2e9b1c28fbc82141a9138ce +R 20087fa0c0f88547e10f5ba33d5674b5 U drh -Z 76fc386c693b15f15cfeb2b7cb92381f +Z c1b9076ff4a79b6edb96280aef7910ea # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c7ffb9789c..ffd6c6ad1d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -aa999d490b743f455f2fb6c41009098330380f0bc2e9b1c28fbc82141a9138ce \ No newline at end of file +bb221381fa38db5be1222d89c567a9bca0e6c441e26a8c797bd326b263556afb \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 106b8073cd..eafc038562 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -4473,8 +4473,7 @@ int sqlite3IntFloatCompare(i64 i, double r){ testcase( x>r ); testcase( x==r ); if( xr ) return +1; /*NO_TEST*/ /* work around bugs in gcov */ - return 0; /*NO_TEST*/ /* work around bugs in gcov */ + return x>r; /*NO_TEST*/ /* work around bug in gcov */ }else{ i64 y; double s; @@ -4483,10 +4482,12 @@ int sqlite3IntFloatCompare(i64 i, double r){ y = (i64)r; if( iy ) return +1; + testcase( r<(double)i ); + testcase( r>(double)i ); + testcase( r==(double)i ); s = (double)i; if( sr ) return +1; - return 0; + return s>r; /*NO_TEST*/ /* work around bug in gcov */ } }