aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/json.c5
-rw-r--r--src/printf.c15
2 files changed, 14 insertions, 6 deletions
diff --git a/src/json.c b/src/json.c
index 67448421b..9783a3898 100644
--- a/src/json.c
+++ b/src/json.c
@@ -307,8 +307,11 @@ static void jsonAppendValue(
jsonAppendRaw(p, "null", 4);
break;
}
- case SQLITE_INTEGER:
case SQLITE_FLOAT: {
+ jsonPrintf(100, p, "%!0.15g", sqlite3_value_double(pValue));
+ break;
+ }
+ case SQLITE_INTEGER: {
const char *z = (const char*)sqlite3_value_text(pValue);
u32 n = (u32)sqlite3_value_bytes(pValue);
jsonAppendRaw(p, z, n);
diff --git a/src/printf.c b/src/printf.c
index b222cb214..d59855917 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -601,11 +601,16 @@ void sqlite3_str_vappendf(
while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; }
while( realvalue<1.0 ){ realvalue *= 10.0; exp--; }
if( exp>350 ){
- bufpt = buf;
- buf[0] = prefix;
- memcpy(buf+(prefix!=0),"Inf",4);
- length = 3+(prefix!=0);
- break;
+ if( flag_zeropad ){
+ realvalue = 9.0;
+ exp = 999;
+ }else{
+ bufpt = buf;
+ buf[0] = prefix;
+ memcpy(buf+(prefix!=0),"Inf",4);
+ length = 3+(prefix!=0);
+ break;
+ }
}
if( xtype!=etFLOAT ){
realvalue += rounder;