This check-in adds the use of "long double" to sqlite3FpDecode() which when
run on x86 using a compiler that translates "long double" into binary80, causes all legacy tests to pass. But on a system where "long double" is just an alias for "double", some of the tests are still failing. FossilOrigin-Name: ce06982f880339cf46704e95c907249827c3e44af2b9420005200ca8abd3f371
This commit is contained in:
parent
453be55b85
commit
fecdff4354
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Reinstate\sthe\sfpdecode()\sSQL\sfunction\sfor\stesting,\sbut\sonly\swhen\scompiled\nwith\sSQLITE_DEBUG.
|
||||
D 2023-07-01T18:33:26.856
|
||||
C This\scheck-in\sadds\sthe\suse\sof\s"long\sdouble"\sto\ssqlite3FpDecode()\swhich\swhen\nrun\son\sx86\susing\sa\scompiler\sthat\stranslates\s"long\sdouble"\sinto\sbinary80,\ncauses\sall\slegacy\stests\sto\spass.\s\sBut\son\sa\ssystem\swhere\s"long\sdouble"\sis\sjust\nan\salias\sfor\s"double",\ssome\sof\sthe\stests\sare\sstill\sfailing.
|
||||
D 2023-07-01T20:21:27.087
|
||||
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 87e6762b026cd733312838b0e9b9acb43d3a3c88c5e612e8077a7320c2bc1692
|
||||
F src/util.c d68692390be083744bd0dfafc797472b0d304743040220e18b93bc9bad8c8d6e
|
||||
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 6f1122e942b8269552daaf13d647d200d8546ec25f36310d67037c6b58d09976
|
||||
R eef1ed887e702bb26e5ed7046220e6a0
|
||||
P 07eab52e0801bb0e4743b304a06ad16e18cdf8eaa18c0faf8d47a1f5d8576ea0
|
||||
R c4051b06b266c29a490b4cec354913fc
|
||||
U drh
|
||||
Z 09a504821196951b22da7c1db783401d
|
||||
Z 95eef79511e3e10371b4b76031a5a06d
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
07eab52e0801bb0e4743b304a06ad16e18cdf8eaa18c0faf8d47a1f5d8576ea0
|
||||
ce06982f880339cf46704e95c907249827c3e44af2b9420005200ca8abd3f371
|
24
src/util.c
24
src/util.c
@ -937,15 +937,16 @@ int sqlite3Atoi(const char *z){
|
||||
** decimal point if n is negative. No rounding is performed if
|
||||
** n is zero.
|
||||
*/
|
||||
void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRound){
|
||||
void sqlite3FpDecode(FpDecode *p, double rr, int iRound, int mxRound){
|
||||
int i;
|
||||
u64 v;
|
||||
int e, exp = 0;
|
||||
long double r;
|
||||
p->isSpecial = 0;
|
||||
if( r<0.0 ){
|
||||
if( rr<0.0 ){
|
||||
p->sign = '-';
|
||||
r = -r;
|
||||
}else if( r==0.0 ){
|
||||
rr = -rr;
|
||||
}else if( rr==0.0 ){
|
||||
p->sign = '+';
|
||||
p->n = 1;
|
||||
p->iDP = 1;
|
||||
@ -954,7 +955,7 @@ void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRound){
|
||||
}else{
|
||||
p->sign = '+';
|
||||
}
|
||||
memcpy(&v,&r,8);
|
||||
memcpy(&v,&rr,8);
|
||||
e = v>>52;
|
||||
if( (e&0x7ff)==0x7ff ){
|
||||
p->isSpecial = 1 + (v!=0x7ff0000000000000L);
|
||||
@ -962,6 +963,7 @@ void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRound){
|
||||
p->iDP = 0;
|
||||
return;
|
||||
}
|
||||
r = rr;
|
||||
|
||||
/* At this point, r is positive (non-zero) and is not Inf or NaN.
|
||||
** The strategy is to multiple or divide r by powers of 10 until
|
||||
@ -969,13 +971,13 @@ void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRound){
|
||||
** an unsigned 64-bit integer v, and extract digits from v.
|
||||
*/
|
||||
if( r>=1.0e+19 ){
|
||||
while( r>=1.0e+119 ){ exp+=100; r /= 1.0e+100; }
|
||||
while( r>=1.0e+29 ){ exp+=10; r /= 1.0e+10; }
|
||||
while( r>=1.0e+19 ){ exp++; r /= 10.0; }
|
||||
while( r>=1.0e+119L ){ exp+=100; r *= 1.0e-100L; }
|
||||
while( r>=1.0e+29L ){ exp+=10; r *= 1.0e-10L; }
|
||||
while( r>=1.0e+19L ){ exp++; r *= 1.0e-1L; }
|
||||
}else{
|
||||
while( r<1.0e-97 ){ exp-=100; r *= 1.0e+100; }
|
||||
while( r<1.0e+07 ){ exp-=10; r *= 1.0e+10; }
|
||||
while( r<1.0e+17 ){ exp--; r *= 10.0; }
|
||||
while( r<1.0e-97L ){ exp-=100; r *= 1.0e+100L; }
|
||||
while( r<1.0e+07L ){ exp-=10; r *= 1.0e+10L; }
|
||||
while( r<1.0e+17L ){ exp--; r *= 1.0e+1L; }
|
||||
}
|
||||
v = (u64)r;
|
||||
i = sizeof(p->z)-1;
|
||||
|
Loading…
Reference in New Issue
Block a user