Final clean-up of the idea of using Dekker double-precision floating
computations to improve accuracy. FossilOrigin-Name: 40285d631072b79aba39cc20d4b217bdf0069f29ac9902cb97dec28d3e4cde11
This commit is contained in:
parent
bc2b65832e
commit
841e596ad0
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Squeeze\sas\smany\sbits\sas\swe\scan\sout\sof\snormalization.
|
||||
D 2023-07-03T10:35:29.478
|
||||
C Final\sclean-up\sof\sthe\sidea\sof\susing\sDekker\sdouble-precision\sfloating\ncomputations\sto\simprove\saccuracy.
|
||||
D 2023-07-03T11:39:38.542
|
||||
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 78be1d552e7038265bb944ef26c9ef94514bd061da19323a0321dde2874f0907
|
||||
F src/util.c 44855f67ac96b546b77b6c2ad128d1e28a56c495038cdda3cae25b8407442f3c
|
||||
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 2994caf5884be07c889519c78fbac4ddcf267fcfe6a3265ecb6390bcd574532e
|
||||
R 50ea777199102a639989a65cb4bb5a5a
|
||||
P 25d1ad6df1ed460c2cc9f32e8a5106e121ae502044f83abf431c1d5b3879eb56
|
||||
R 8a559af6860b1623fc9d9f5fb9393b11
|
||||
U drh
|
||||
Z 91cee9d1957f1c63a4a3d422340e91a7
|
||||
Z 48672189b786297b4026c7966b4eccaa
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
25d1ad6df1ed460c2cc9f32e8a5106e121ae502044f83abf431c1d5b3879eb56
|
||||
40285d631072b79aba39cc20d4b217bdf0069f29ac9902cb97dec28d3e4cde11
|
15
src/util.c
15
src/util.c
@ -999,8 +999,8 @@ void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRound){
|
||||
/* Multiply r by powers of ten until it lands somewhere in between
|
||||
** 1.0e+19 and 1.0e+17.
|
||||
*/
|
||||
if( sizeof(long double)>8 && 0 ){
|
||||
long double rr = r;
|
||||
if( sizeof(LONGDOUBLE_TYPE)>8 ){
|
||||
LONGDOUBLE_TYPE rr = r;
|
||||
if( rr>=1.0e+19 ){
|
||||
while( rr>=1.0e+119L ){ exp+=100; rr *= 1.0e-100L; }
|
||||
while( rr>=1.0e+29L ){ exp+=10; rr *= 1.0e-10L; }
|
||||
@ -1012,6 +1012,15 @@ void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRound){
|
||||
}
|
||||
v = (u64)rr;
|
||||
}else{
|
||||
/* If high-precision floating point is not available using "long double",
|
||||
** then use Dekker-style double-double computation to increase the
|
||||
** precision.
|
||||
**
|
||||
** The error terms on constants like 1.0e+100 computed using the
|
||||
** decimal extension, for example as follows:
|
||||
**
|
||||
** SELECT decimal_sci(decimal_sub('1.0e+100',decimal(1.0e+100)));
|
||||
*/
|
||||
double rr = 0.0;
|
||||
if( r>1.84e+19 ){
|
||||
while( r>1.84e+119 ){
|
||||
@ -1029,7 +1038,7 @@ void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRound){
|
||||
}else{
|
||||
while( r<1.84e-82 ){
|
||||
exp -= 100;
|
||||
mul2(r, rr, 1.0e+100, -1.5902891109759918046, &r, &rr);
|
||||
mul2(r, rr, 1.0e+100, -1.5902891109759918046e+83, &r, &rr);
|
||||
}
|
||||
while( r<1.84e+08 ){
|
||||
exp -= 10;
|
||||
|
Loading…
Reference in New Issue
Block a user