mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Merge updates from trunk.
FossilOrigin-Name: 6f07f20e41446212a86989a5e6ce7f12998a3ae3
This commit is contained in:
@@ -83,7 +83,8 @@ static LogEst logEstFromDouble(double x){
|
||||
LogEst e;
|
||||
assert( sizeof(x)==8 && sizeof(a)==8 );
|
||||
if( x<=0.0 ) return -32768;
|
||||
if( x<1.0 ) return -logEstFromDouble(1/x);
|
||||
if( x<0.01 ) return -logEstFromDouble(1.0/x);
|
||||
if( x<1.0 ) return logEstFromDouble(100.0*x) - 66;
|
||||
if( x<1024.0 ) return logEstFromInteger((sqlite3_uint64)(1024.0*x)) - 100;
|
||||
if( x<=2000000000.0 ) return logEstFromInteger((sqlite3_uint64)x);
|
||||
memcpy(&a, &x, 8);
|
||||
@@ -156,8 +157,10 @@ int main(int argc, char **argv){
|
||||
}
|
||||
}
|
||||
for(i=n-1; i>=0; i--){
|
||||
if( a[i]<0 ){
|
||||
if( a[i]<-40 ){
|
||||
printf("%5d (%f)\n", a[i], 1.0/(double)logEstToInt(-a[i]));
|
||||
}else if( a[i]<10 ){
|
||||
printf("%5d (%f)\n", a[i], logEstToInt(a[i]+100)/1024.0);
|
||||
}else{
|
||||
sqlite3_uint64 x = logEstToInt(a[i]+100)*100/1024;
|
||||
printf("%5d (%lld.%02lld)\n", a[i], x/100, x%100);
|
||||
|
Reference in New Issue
Block a user