diff options
author | drh <> | 2023-02-24 01:08:35 +0000 |
---|---|---|
committer | drh <> | 2023-02-24 01:08:35 +0000 |
commit | 4b04ced3e05f46afb0e86631566a1adeb3113935 (patch) | |
tree | e8afa31bf29b6851bcf1d8f1c54861d035a92737 /src/printf.c | |
parent | ed530c022174b1db212a8336c917c3fcfa539a57 (diff) | |
download | sqlite-4b04ced3e05f46afb0e86631566a1adeb3113935.tar.gz sqlite-4b04ced3e05f46afb0e86631566a1adeb3113935.zip |
Fix an incorrect optimization that was attempted as part of
check-in [18de3a8e6b431a07].
FossilOrigin-Name: f32055e8110a2eac6c9e26d1d1e620f0668bcb475d49d309dc549cea05e1e582
Diffstat (limited to 'src/printf.c')
-rw-r--r-- | src/printf.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/printf.c b/src/printf.c index 49a278931..45a31ec8d 100644 --- a/src/printf.c +++ b/src/printf.c @@ -574,20 +574,16 @@ void sqlite3_str_vappendf( msd = 0; longvalue = 0; /* To prevent a compiler warning */ idx = precision & 0xfff; - if( idx>20 ){ - rounder = 0.0; - }else{ - rounder = arRound[idx%10]; - while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; } - if( xtype==etFLOAT ){ - double rx = (double)realvalue; - sqlite3_uint64 u; - int ex; - memcpy(&u, &rx, sizeof(u)); - ex = -1023 + (int)((u>>52)&0x7ff); - if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16; - realvalue += rounder; - } + rounder = arRound[idx%10]; + while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; } + if( xtype==etFLOAT ){ + double rx = (double)realvalue; + sqlite3_uint64 u; + int ex; + memcpy(&u, &rx, sizeof(u)); + ex = -1023 + (int)((u>>52)&0x7ff); + if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16; + realvalue += rounder; } if( sqlite3IsNaN((double)realvalue) ){ bufpt = "NaN"; |