From 5270d7424d2e9f47c450fe85753c0768e2f41b3b Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 3 Jul 2023 10:18:02 +0000 Subject: [PATCH] Faster Dekker multiplication that removes the restriction on input magnitude. FossilOrigin-Name: 2994caf5884be07c889519c78fbac4ddcf267fcfe6a3265ecb6390bcd574532e --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/util.c | 18 +++++++++--------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/manifest b/manifest index 5ae086cfa2..593e1f7fd9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sone\sconstant\sin\sthe\snormalization\slogic.\s\sImproved\serror\soutput\nfrom\satof1.test. -D 2023-07-03T10:00:38.019 +C Faster\sDekker\smultiplication\sthat\sremoves\sthe\srestriction\son\sinput\smagnitude. +D 2023-07-03T10:18:02.499 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -705,7 +705,7 @@ F src/trigger.c ad6ab9452715fa9a8075442e15196022275b414b9141b566af8cdb7a1605f2b0 F src/update.c 0aa36561167a7c40d01163238c297297962f31a15a8d742216b3c37cdf25f731 F src/upsert.c 5303dc6c518fa7d4b280ec65170f465c7a70b7ac2b22491598f6d0b4875b3145 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 -F src/util.c eae1eeaf2de968bc32d81274b6209a6685d8f68f8a44fb80bc77602860feede8 +F src/util.c e920f80d429285da398e33852e47b1731fd474d4fc8fd38ea16e74f7f15c100c F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104 F src/vdbe.c 74282a947234513872a83b0bab1b8c644ece64b3e27b053ef17677c8ff9c81e0 F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 @@ -2041,8 +2041,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 4fa6938dac2d3d813a37664053db31451a2a065f78dd212488f5f7f8d583ddc5 -R df6eb47114802d2c438e907f9bdbb126 +P d3c48807100a358a70fdd799c8935eba1b765ace2e1ddea4475fd673006cb6da +R 46c57ca0802519e59042da4b712e623e U drh -Z 7f5799444e9a2cb0ee3bb904fd4adcc7 +Z 937d038b18f0b1ea37450ce437120a68 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a69b8691ba..1fa06bc7fa 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d3c48807100a358a70fdd799c8935eba1b765ace2e1ddea4475fd673006cb6da \ No newline at end of file +2994caf5884be07c889519c78fbac4ddcf267fcfe6a3265ecb6390bcd574532e \ No newline at end of file diff --git a/src/util.c b/src/util.c index 40662f021c..7456599bc9 100644 --- a/src/util.c +++ b/src/util.c @@ -940,10 +940,15 @@ static void mul2( double *z, double *zz ){ double hx, tx, hy, ty, p, q, c, cc; - p = 67108865.0 * x; - hx = x - p + p; tx = x - hx; - p = 67108865.0 * y; - hy = y - p + p; ty = y - hy; + u64 m; + memcpy(&m, &x, 8); + m &= 0xfffffffffc000000L; + memcpy(&hx, &m, 8); + tx = x - hx; + memcpy(&m, &y, 8); + m &= 0xfffffffffc000000L; + memcpy(&hy, &m, 8); + ty = y - hy; p = hx*hy; q = hx*ty + tx*hy; c = p+q; @@ -1010,11 +1015,6 @@ void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRound){ double rr = 0.0; if( r>=1.0e+19 ){ while( r>=1.0e+119 ){ - if( r>=1.0e+300 ){ - exp += 300; - r *= 1.0e-300; - break; - } exp += 100; mul2(r, rr, 1.0e-100, -1.99918998026028836196e-117, &r, &rr); } -- 2.47.2