diff options
author | drh <> | 2023-07-03 10:18:02 +0000 |
---|---|---|
committer | drh <> | 2023-07-03 10:18:02 +0000 |
commit | 5270d7424d2e9f47c450fe85753c0768e2f41b3b (patch) | |
tree | 0a9d568e0bcf9e6fa3ffa0f233349d05f8f86127 /src | |
parent | 37b188fbca861daa26f649bfaa4c42771ff315d7 (diff) | |
download | sqlite-5270d7424d2e9f47c450fe85753c0768e2f41b3b.tar.gz sqlite-5270d7424d2e9f47c450fe85753c0768e2f41b3b.zip |
Faster Dekker multiplication that removes the restriction on input magnitude.
FossilOrigin-Name: 2994caf5884be07c889519c78fbac4ddcf267fcfe6a3265ecb6390bcd574532e
Diffstat (limited to 'src')
-rw-r--r-- | src/util.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/util.c b/src/util.c index 40662f021..7456599bc 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); } |