> Changing the 2 "15g" entries in sqlite3.c to "16g" corrects this problem. 15 
> digits is all that is guaranteed but the vast majority of 16-digit values are 
> representable.
>
> Is this a valid solution?  Or are there other side effects?

It should be ok. However there's another bug that will appear after
the change:

C:\Users\vic\Desktop\sqlite-amalgamation-3070800>cat test.c
#include "sqlite3.h"
#include <stdio.h>

int main() {
  double d = 8901.0;
  char * c = sqlite3_mprintf("%.15g\n%.16g\n", d, d);
  printf("%s%.16g\n", c, d);
}

C:\Users\vic\Desktop\sqlite-amalgamation-3070800>cl /nologo test.c
sqlite3.c
test.c
sqlite3.c
Generating Code...

C:\Users\vic\Desktop\sqlite-amalgamation-3070800>test.exe
8901
8901.000000000001
8901

C:\Users\vic\Desktop\sqlite-amalgamation-3070800>gcc test.c sqlite3.c

C:\Users\vic\Desktop\sqlite-amalgamation-3070800>a.exe
8901
8901.000000000001
8901

So with .15g result is correct but with .16g is not. The problem with .
16g doesn't appear in gcc's and visual's printf.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to