1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Faster Dekker multiplication that removes the restriction on input magnitude.

FossilOrigin-Name: 2994caf5884be07c889519c78fbac4ddcf267fcfe6a3265ecb6390bcd574532e
This commit is contained in:
drh
2023-07-03 10:18:02 +00:00
parent 37b188fbca
commit 5270d7424d
3 changed files with 16 additions and 16 deletions

View File

@@ -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);
}